title: Key 'Category' not found in <QueryDict: {}>
body: <p>I'm been trying to fix a form which has a problem of reseting particular value ,everytime a value is input into the form.</p>
  
  <p>I'm following this tutorial on how to a particular value stay after the form is submitted and all of the sudden ,</p>
  
  <p>I get this error </p>
  
  <pre><code>Key 'Category' not found in &lt;QueryDict: {}&gt;
  
   File "C:\o\mysite\pet\views.py" in WhiteBoardFinder
     234.     if request.GET['Category']:
   File "C:\Python26\Lib\site-packages\django\utils\datastructures.py" in __getitem__
     258.             raise MultiValueDictKeyError("Key %r not found in %r" % (key, self))
  </code></pre>
  
  <p>I can't seem to understand this problem because my forms field is called Category and i'm using a django generated form.</p>
  
  <p>My views.py</p>
  
  <pre><code>def WhiteBoardFinder(request):
      if request.GET['Category']:
          request.session['Category'] = request.GET['Category']
          category = request.GET['Category']
          posts = WhiteBoard.objects.filter(Category=category)
          form = WhiteBoardFinderForm(initial={'Category': request.session.get('Category')})
          paginator = Paginator(posts, 1)
  
          try: page = int(request.GET.get("page", '1'))
          except ValueError: page = 1
  
          try:
              posts = paginator.page(page)
          except (InvalidPage, EmptyPage):
              posts = paginator.page(paginator.num_pages)
          return render(request,"whiteboardfinder.html",{"posts":posts,'form':form},)
      return render(request,"whiteboardfinder.html",{'form':WhiteBoardFinderForm()})
  </code></pre>
  
  <p>My forms.py</p>
  
  <pre><code>class WhiteBoardFinderForm(forms.ModelForm):
          class Meta:
                  model = WhiteBoard
                  fields = ('Category',)
  </code></pre>
  
  <p>My whiteboardfinder.html</p>
  
  <pre><code>&lt;form method="GET"&gt;
      {{ form.as_p }}
      &lt;input type="submit" value="Search"&gt;
  &lt;/form&gt;
  
  
          {% for post in posts.object_list %}
              &lt;div class="title"&gt;{{ post.name }}&lt;/div&gt;
              {% endfor %}
  
  
      &lt;!-- Next/Prev page links  --&gt;
      {% if posts.object_list and posts.paginator.num_pages &gt; 1 %}
      &lt;div class="pagination" style="margin-top: 20px; margin-left: -20px; "&gt;
          &lt;span class="step-links"&gt;
              {% if posts.has_previous %}
                  &lt;a href= "?page={{ posts.previous_page_number }}"&gt;newer entries &amp;lt;&amp;lt; &lt;/a&gt;
              {% endif %}
  
              &lt;span class="current"&gt;
                  &amp;nbsp;Page {{ posts.number }} of {{ posts.paginator.num_pages }}
              &lt;/span&gt;
  
              {% if posts.has_next %}
                  &lt;a href="?page={{ posts.next_page_number }}"&gt; &amp;gt;&amp;gt; older entries&lt;/a&gt;
              {% endif %}
          &lt;/span&gt;
      &lt;/div&gt;
      {% endif %}
  
  &lt;/div&gt;
  </code></pre>