class FarmersMarket(ModelForm): class Meta: model = models.FarmersMarket exclude = ('location',)
def clean(self): place, (lat, lng) = _g.geocode(self.cleaned_data['address']) self.cleaned_data['location'] = Point(lng,lat) return self.cleaned_data ---- Here's my code minus the exception handling. Now what I *want* to have happen is that the models.FarmersMarket.location field on the model is set sometime shortly after the form is submitted by the user, by way of geocoding the data, rather than having them tediously enter a POINT wkt string in the textarea field. So my idea was to put a call to geopy.Google.geocode in FarmersMarket.self.clean. I can confirm clean() is getting called, but for some reason, the 'location' field isn't being set in the model. I get a whine from Django that the location field cannot be NULL (which is true, it can't). Can anyone tell me how I'm supposed to be doing this? I want them to enter an address on the form, not a latitude/longitude pair. -- Jeff -- 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.