On 1/16/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote:
I'd suggest exposing the long/lat fields in the admin and putting a
"Geocode this address" shortcut that, when clicked, would do the
geocoding server-side and populate the long/lat fields with the
result. You can do this by hooking into the admin site with JavaScript
(the "js" option to "class Admin") or by overriding the template for
that particular admin page.

Good advice, though to deal with the multiple results issue, you can
force geopy to give you a generator rather than raising an exception
when there's more than one:

                       ret_gen = g.geocode(", ".join(addy_parts),
                                           exactly_one=False)
                       try: #use the first one.
                           place, (lat, lng) = ret_gen.next()
                       except StopIteration:
                           raise

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to