Wednesday, March 30, 2011

Documentation Checked But Unclear: How to supress form.errors from views when needed?

I have an edit screen with more than a dozen fields on it of various
types (text/CharField, select/CharField, date/DateField). When I
refresh the screen sometimes I want to suppress all of the field
required errors generated by empty fields prior to the refresh
actually taking place. So far I have not found anything that works. I
know in a view that I can check if there are errors for particular
fields(like this if form.errors.has_key('title') :
titleerrors = len(form.errors['title'] titleerrors =
str(titleerrors))) and then display the counts on the screen, but I
have not figured out how to suppress them yet once I know they exist.
I do not believe that I can suppress them at the form level in
forms.py, in an overridden clean() method, without suppressing them
all of the time, which is not my intent. Thanks for the help.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment