I have a model that has a required attribute, but I want this
attribute set to a calculated value based on the input from a form. So
inside the save() method of my ModelForm class, I'm doing:

self.cleaned_data['requiredKey'] = 123
record = forms.ModelForm.save(self)

However, this raises the error "ValueError: The Record could not be
created (Property requiredKey is required)".

Is cleaned_data read-only? How would I modify the data used when
creating the model? I realize I could probably set requiredKey as a
form field, and then set it in clean_requiredKey(), but I don't want
the field included in the actual form (not even as a hidden field).

Any help is appreciated.

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

Reply via email to