Re: Accessing schemas in django

2010-09-27 Thread Nabil Servais

 Hello,


Le 27/09/2010 08:53, Jean-Pierre De Villiers a écrit :

Hi,
Is there a way to access an existing database schema in Django?
Any help would be appreciated!

J




You can use the inspectdb option of the project manager, you will find 
more information in the official documentation :


http://docs.djangoproject.com/en/dev/ref/django-admin/?from=olddocs

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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.



Re: Possible to do location detection?

2010-08-25 Thread Nabil Servais

 Hello,

Le 25/08/2010 09:37, Andy a écrit :

I'd like to detect the location of each user and then set the default
language and location for him accordingly. The homepage would also be
tailored to each location (country and city).

Can anyone share information on how to do that with Django?


You can use geoip with geodjango :

http://docs.djangoproject.com/en/dev/ref/contrib/gis/geoip/


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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.



Re: Python Database Framework

2010-05-14 Thread Nabil Servais
Hello
Le 14 mai 2010 à 16:47, Ozgur Yılmaz a écrit :

> Hi everybody,
> 
> Do anyone knows a Python Database framework, which resembles Django's 
> approach to database programming?

Yes, Elixir : http://elixir.ematia.de/trac/wiki. 


> I need it to use outside of Django, for other Python scripts.
> 
> Best regards,
> 
> E.Ozgur Yilmaz
> Lead Technical Director
> www.ozgurfx.com
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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.



Re: Geodjango tutorials?

2010-04-04 Thread Nabil Servais

Le 3 avr. 2010 à 04:16, Benjamin Welton a écrit :

> Hey All,
> 
>   Im wondering if anyone has some good links to geodjango tutorials (outside 
> of the main one featured on geodjango.org)? Specifically any related to 
> Google Map integration (since that subsection appears to be missing in the 
> current doc's).
> 
> Thanks
> Ben
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
> 

Hello, 

http://github.com/palewire/nicar2010/tree/master/geodjango_dunktank/


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Re: Django point field

2009-09-25 Thread Nabil Servais

Hello,

I use json for output instead of cvs, and it works. Also I convert the 
lattitude and longitude into float.

enjoy

def get_lat_long(location):
 key = settings.GOOGLE_API_KEY
 output = "json"
 location = urllib.quote_plus(location)
 request = 
"http://maps.google.com/maps/geo?q=%s&output=%s&key=%s 
" % (location, 
output, key)
 data = urllib.urlopen(request).read()
 dlist = simplejson.loads(data)
 if dlist['Status']['code'] == 200:
 lat = float(dlist['Placemark'][0]['Point']['coordinates'][0])
 long = float(dlist['Placemark'][0]['Point']['coordinates'][1])
 return (lat, long)
 else
 return ''



Le 25/09/2009 09:47, please smile a écrit :
> Hi all,
> I have a problem to convert latitude and longitude values into 
> point field value.
>
>
> def get_lat_long(location):
> key = settings.GOOGLE_API_KEY
> output = "csv"
> location = urllib.quote_plus(location)
> request = 
> "http://maps.google.com/maps/geo?q=%s&output=%s&key=%s 
> " % (location, 
> output, key)
> data = urllib.urlopen(request).read()
> dlist = data.split(',')
> if dlist[0] == '200':
> #return "%s, %s" % (dlist[2], dlist[3])
> return (dlist[2], dlist[3])
> else:
> return ''
>
>
> My models.py
> --
> class Person(models.Model):
> address = models.CharField(_('address'), max_length=200, 
> blank=True)
> city = models.CharField(_('city'), max_length=100, blank=True)
> state = USStateField(_('state'), blank=True)
> zipcode = models.CharField(_('zip code'), max_length=5, 
> blank=True)
> point = models.PointField(blank=True, null=True)
>
> objects = models.GeoManager()
>
>
>
> def save(self, force_insert=False, force_update=False):
>
> if self.point == None:
> location = "%s+%s+%s+%s" % (self.address, self.city, 
> self.state, self.zipcode)
> point_lat, point_long = get_lat_long(location)
> pnt = Point(point_long, point_lat)
> self.point = pnt
>
> Here I convert latitude , longitude value into point field value. But 
> i am getting   "Exception Value: Invalid parameters given for Point 
> initialization."
>
> please advise...
> Thank you
>
>  Trace back
>  ---
>  Environment:
>
> Request Method: POST
> Request URL: http://192.168.1.57:8000/admin/people/person/add/
> Django Version: 1.1
> Python Version: 2.5.2
> Installed Applications:
> ['peoplesearch.people',
>  'django.contrib.admin',
>  'django.contrib.gis',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.databrowse',
>  'peoplesearch.haystack']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware')
>
>
> Traceback:
> File "/root/myprojects/directory/django/core/handlers/base.py" in 
> get_response
>   92. response = callback(request, *callback_args, 
> **callback_kwargs)
> File "/root/myprojects/directory/django/contrib/admin/options.py" in 
> wrapper
>   226. return self.admin_site.admin_view(view)(*args, 
> **kwargs)
> File "/root/myprojects/directory/django/views/decorators/cache.py" in 
> _wrapped_view_func
>   44. response = view_func(request, *args, **kwargs)
> File "/root/myprojects/directory/django/contrib/admin/sites.py" in inner
>   186. return view(request, *args, **kwargs)
> File "/root/myprojects/directory/django/db/transaction.py" in 
> _commit_on_success
>   240. res = func(*args, **kw)
> File "/root/myprojects/directory/django/contrib/admin/options.py" in 
> add_view
>   734. self.save_model(request, new_object, form, 
> change=False)
> File "/root/myprojects/directory/django/contrib/admin/options.py" in 
> save_model
>   557. obj.save()
> File "/root/myprojects/peoplesearch/../peoplesearch/people/models.py" 
> in save
>   118. pnt = Point(point_long, point_lat)
> File "/root/myprojects/directory/django/contrib/gis/geos/point.py" in 
> __init__
>   32. raise TypeError('Invalid parameters given for Point 
> initialization.')
>
> Exception Type: TypeError at /admin/people/person/add/
> Exception Value: Invalid parameters given for Point initialization.
>
>
> >


--~--~-~--~~~---~--~~
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
F

Re: Django point field

2009-09-25 Thread Nabil Servais

Hello,

I solve your probleme in changing the output format into json, then I
convert the coordinates into Float.

def get_lat_long(location):
key = ''
output = "json"
location = urllib.quote_plus(location)
request = "http://maps.google.com/maps/geo?q=%s&output=%s"; %
(location, output)
data = urllib.urlopen(request).read()
dlist = simplejson.loads(data)
lat = float(dlist['Placemark'][0]['Point']['coordinates'][0])
lon = float(dlist['Placemark'][0]['Point']['coordinates'][1])
if dlist['Staut']['code'] == 200:
return (lat,lon)
I've tested and it works. Good luck

On 25 sep, 09:47, please smile  wrote:
> Hi all,
>     I have a problem to convert latitude and longitude values into point
> field value.
>
>     def get_lat_long(location):
>         key = settings.GOOGLE_API_KEY
>         output = "csv"
>         location = urllib.quote_plus(location)
>         request = "http://maps.google.com/maps/geo?q=%s&output=%s&key=%s"; %
> (location, output, key)
>         data = urllib.urlopen(request).read()
>         dlist = data.split(',')
>         if dlist[0] == '200':
>             #return "%s, %s" % (dlist[2], dlist[3])
>             return (dlist[2], dlist[3])
>         else:
>             return ''
>
>     My models.py
>     --
>     class Person(models.Model):
>         address = models.CharField(_('address'), max_length=200, blank=True)
>         city = models.CharField(_('city'), max_length=100, blank=True)
>         state = USStateField(_('state'), blank=True)
>         zipcode = models.CharField(_('zip code'), max_length=5, blank=True)
>         point = models.PointField(blank=True, null=True)
>
>         objects = models.GeoManager()
>
>         def save(self, force_insert=False, force_update=False):
>
>         if self.point == None:
>             location = "%s+%s+%s+%s" % (self.address, self.city, self.state,
> self.zipcode)
>             point_lat, point_long = get_lat_long(location)
>             pnt = Point(point_long, point_lat)
>             self.point = pnt
>
> Here I convert latitude , longitude value into point field value. But i am
> getting   "Exception Value: Invalid parameters given for Point
> initialization."
>
> please advise...
> Thank you
>
>  Trace back
>  ---
>  Environment:
>
> Request Method: POST
> Request URL:http://192.168.1.57:8000/admin/people/person/add/
> Django Version: 1.1
> Python Version: 2.5.2
> Installed Applications:
> ['peoplesearch.people',
>  'django.contrib.admin',
>  'django.contrib.gis',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.databrowse',
>  'peoplesearch.haystack']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware')
>
> Traceback:
> File "/root/myprojects/directory/django/core/handlers/base.py" in
> get_response
>   92.                 response = callback(request, *callback_args,
> **callback_kwargs)
> File "/root/myprojects/directory/django/contrib/admin/options.py" in wrapper
>   226.                 return self.admin_site.admin_view(view)(*args,
> **kwargs)
> File "/root/myprojects/directory/django/views/decorators/cache.py" in
> _wrapped_view_func
>   44.         response = view_func(request, *args, **kwargs)
> File "/root/myprojects/directory/django/contrib/admin/sites.py" in inner
>   186.             return view(request, *args, **kwargs)
> File "/root/myprojects/directory/django/db/transaction.py" in
> _commit_on_success
>   240.                 res = func(*args, **kw)
> File "/root/myprojects/directory/django/contrib/admin/options.py" in
> add_view
>   734.                 self.save_model(request, new_object, form,
> change=False)
> File "/root/myprojects/directory/django/contrib/admin/options.py" in
> save_model
>   557.         obj.save()
> File "/root/myprojects/peoplesearch/../peoplesearch/people/models.py" in
> save
>   118.             pnt = Point(point_long, point_lat)
> File "/root/myprojects/directory/django/contrib/gis/geos/point.py" in
> __init__
>   32.             raise TypeError('Invalid parameters given for Point
> initialization.')
>
> Exception Type: TypeError at /admin/people/person/add/
> Exception Value: Invalid parameters given for Point initialization.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---