On 23-Mar-09, at 5:53 PM, AKK wrote:
> I'm working through chapter 7 of the djangobook online. and i've got
> the following:
>
> def search(request):
> if 'criteria' in request.GET:
>
> however, if i leave it blank rather than it saying "You submitted an
> empty form" it says:
>
> Can someone tell me how to fix this or mention why it occurs?
Line two merely checks for the presence of the field, not its contents
so you probably want (untested)
if request.GET.get('criteria'):
--
Andy McKay
Clearwind Consulting: www.clearwind.ca
Blog: www.agmweb.ca/blog/andy
Twitter: twitter.com/clearwind
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---