title: local variable 'context_dict' referenced before assignment
body: <p>Can someone please explain me what this error means? What is assignment? Where context_dict should be? Or I made some other mistake? I am new to Django. Thank you so much.</p>
  
  <pre><code>def add_page(request, category_name_slug):
      try:
          cat = Category.objects.get(slug=category_name_slug)
      except Category.DoesNotExist:
          cat = None
  
      if request.method == 'POST':
          form = PageForm(request.POST)
          if form.is_valid():
              if cat:
                  page = form.save(commit=False)
                  page.category = cat
                  page.views = 0
                  page.save()
                  # probably better to use a redirect here.
                  return category(request, category_name_slug)
             else:
                 print form.errors
          else:
              form = PageForm()
  
          context_dict = {'form':form, 'category': cat}
  
      return render(request, 'rango/add_page.html', context_dict)
  </code></pre>
  
  <p>I got this error:</p>
  
  <pre><code>local variable 'context_dict' referenced before assignment
  </code></pre>
  
  <p>and exception is pointing me on line with return render(reqyest, 'rango/add_page.html', context_dict)</p>
  
  <p>the same Traceback</p>