I feel your pain, validating forms can be a PITA... Try reading through this last bit of the form validation docs:
https://docs.djangoproject.com/en/dev/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other Cheers, André Terra On Mon, Jul 11, 2011 at 6:02 PM, Brian McKeever <kee...@gmail.com> wrote: > I have a search form that is used by a view to search for results and > then redirect to display them one at a time. If my search doesn't find > any objects matching the criteria, I'd like to display a message > saying so. > > It seems natural to add this error to the search form and redisplay it > since it already displays error with the search. > > Is there an easy way to do this, or should I be doing something else > because a failed database query is not a form error? > > I've been trying to do this: > form.non_field_errors().append(forms.ValidationError("No roblems found > matching that criteria")) > but it doesn't work (non_field_errors() is not well documented). > > -- > 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. > > -- 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.