Re: using a models fields

2011-04-04 Thread bishwendu kundu
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.  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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



[no subject]

2011-03-30 Thread bishwendu kundu
 for different databases the query could be formatted as
s=temp1.objects.using("mytemp").filter(refId=table1.objects.using("normal").get(pk=something).id)
I cannot understand the get argument but may be if you give it a try with a
suitable args."using" differentiates between databases.

For the first problem;
   may be if you get the cursor to the connection you want to keep open and
execute sql commands directly on it.This can be done as

from django.db import connections
cursor=connection["your_db_alias used in settings"].cursor()

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.