Here's my form :
<form action = "/search/" method = "get">
<input type = "text" name = "q">
<input type = "submit" value = "Search">
</form>
And here's my view:
def search(request):
if 'q' in request.GET:
message = 'You searched for: %r' % request.GET['q']
else:
message = 'You submitted an empty form :('
return HttpResponse(message)
When I try to input something everything works fine, except for weird u' ' thing. For example when I enter asdasda I get the output You searched for: u'asdsa'
. Another problem is that when I submit an empty form the output is simply u''
, when it should be "You submitted an empty form :(". I'm reading "The Django Book", the 1.x.x version and this was an example..