Tuesday, March 29, 2011

Invalid values in a form cause validation to fail

I have a form within a view which allows users to filter results
within a database. The request is a GET because I want the users to be
able to bookmark the results.

My querystring looks something like:

http://127.0.0.1:8001/myapp/?organisation_name=&corporation=4&authorisation_status=

My view checks the form as it comes in (form.is_valid()) and bounces
them back if they have been messing about with the querystring. The
validation picks up errors if I do something like
"..&corporation=999999&...", but if I do something like
"...&corporation=wwww&...." it brings up a traceback

Exception Value:
invalid literal for int() with base 10: 'wwww'

I would have expected that the validation process would have picked up
that it isn't valid and just returned field error.

Or am I doing something wrong.

--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate