Re: using a models fields
You can try saving the data as latitude=models.DecimalField(max_digits=7,decimal_places=4).Same for the longitude field.Here the max_digits takes into account both decimal and non-decimal places.All the data can be given in string form as it will be automatically converted to proper format as specified in your models for storing in database. I guess you will be using some criteria to extract data from the database.......so,code can look like
list_of_XYZ()=XYZ.objects.filter(criteria)
for i in list_of_XYZ:
i.latitude,i.longitude ,i.zoomlevel
-- On Tue, Apr 5, 2011 at 1:45 AM, jay K. <jay.developer2000@gmail.com> wrote:
Hello,
I got a couple of fields from a model I want to use
so the models.py looks like this
class XZY():
latitude = models.CharField(....)
longitude = models.CharField(.....)
zoomlevel = models.CharField(....)
I want to retrieve the data inside latitude, longitude and zoomlevel
to be able to create a static map for different locations, using google maps
How can I retrieve the fields data?
thanks
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home