I have the following code in a view, where UserSurveyForm is a
ModelForm.
f = UserSurveyForm(request.POST, instance=thisuser)
if f.is_valid():
[...]
When I try submitting valid data, this works fine. However, when I
submit an incomplete form, I get the following traceback:
[...]
50. if f.is_valid():
File "/usr/lib/python2.5/site-packages/django/forms/models.py" in save
319. return save_instance(self, self.instance,
self._meta.fields, fail_message, commit)
File "/usr/lib/python2.5/site-packages/django/forms/models.py" in
save_instance
42. " validate." % (opts.object_name,
fail_message))
Exception Type: ValueError at /games/pd/survey/
Exception Value: The User could not be changed because the data didn't
validate.
Based on the documentation I've read, I thought that is_valid() should
just return False if the form doesn't validate, instead of throwing an
error. Any information on this?
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---