title: Django request.GET
body: <p>It seems I can't make this example print &quot;You submitted nothing!&quot;.
  Every time I submit an empty form it says:</p>
  <blockquote>
  <p>You submitted: u''</p>
  </blockquote>
  <p>instead of:</p>
  <blockquote>
  <p>You submitted nothing!</p>
  </blockquote>
  <p>Where did I go wrong?</p>
  <p>views.py</p>
  <pre><code>def search(request):
      if 'q' in request.GET:
          message = 'You submitted: %r' % request.GET['q']
      else:
          message = 'You submitted nothing!'
  
      return HttpResponse(message)
  </code></pre>
  <p>template:</p>
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt; Search &lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form action=&quot;/search/&quot;  method=&quot;get&quot; &gt;
          &lt;input type=&quot;text&quot; name = &quot;q&quot;&gt;
          &lt;input type=&quot;submit&quot;value=&quot;Search&quot;/&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>