KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
It seems I can't make this example print "You submitted nothing!". Every time I submit an empty form it says: You submitted: u'' instead of: You submitted nothing! Where did I go wrong? views.py def search(request): if 'q' in request.GET: message = 'You submitted: %r' % request.GET['q'] else: message = 'You submitted nothing!' return HttpResponse(message) template: <html> <head> <title> Search </title> </head> <body> <form action="/search/" method="get" > <input type="text" name = "q"> <input type="submit"value="Search"/> </form> </body> </html>
Tags (comma-separated)
Save Edits
Cancel