I have fields in the model that do not appear in the form. Those fields are filled in by a geocode result.
but the data is not getting saved class EditContactForm(forms.ModelForm): """ this is the parent form class for all contact editing """ class Meta: model = Contact exclude = ('city','state','country','postcode','street') def clean(self): super(EditContactForm, self).clean() address = self.cleaned_data['address'] json = self.data['address_json'] if json: # only gets a json input if something was changed and javascript is on geo = simplejson.loads(json) geodict = gparse_create_csc(geo) self.cleaned_data['street'] = geodict['street_address'] self.cleaned_data['city'] = geodict['city'] self.cleaned_data['state'] = geodict['state'] self.cleaned_data['country'] = geodict['country'] self.cleaned_data['postcode'] = geodict['postal_code'] # cleaned_data is all correctly filled in here return self.cleaned_data def save(self,commit=True): # self.changed_data = ['address'] # adding the other fieldnames did not work self.instance.street = self.cleaned_data['street'] self.instance.city = self.cleaned_data['city'] self.instance.state = self.cleaned_data['state'] self.instance.country = self.cleaned_data['country'] self.instance.postal_code = self.cleaned_data['postcode'] return super(EditContactForm, self).save(commit) what do I have to do to get these fields to be saved ? thanks felix : crucial-systems.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-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 -~----------~----~----~----~------~----~------~--~---