title: Django returning blank page on POST
body: <p>This is almost certainly a newbie error but I can't work out what's wrong. I've read through the other similar questions on here but non seem to be quite the same.</p>
  
  <p>I have a simple form which posts data but I always get a completely blank response.</p>
  
  <p>Here's the code:</p>
  
  <p>url.py</p>
  
  <pre><code>urlpatterns = patterns('shotgun.views',
      # shotgun App URL patterns
      url(r'^$', ControlPanelView.as_view(), name='index'),
  )
  </code></pre>
  
  <p>form.py</p>
  
  <pre><code>class ProjectAssignmentForm(forms.Form):
  
      projects = MultipleChoiceField(widget=forms.CheckboxSelectMultiple)
  
      def __init__(self, user_projs, *args, **kwargs):
          super(ProjectAssignmentForm, self).__init__(*args, **kwargs)
  
          self.fields["projects"].choices = tuple([(item.name, item.name) for item in SGProject.objects.all() if item.name != "Template Project"])
          self.fields["projects"].initial = user_projs
  </code></pre>
  
  <p>view.py</p>
  
  <pre><code>class ControlPanelView(SLBaseView):
  
      template_name = "shotgun/index.html"
  
      def get_context_data(self, **kwargs):
          context = super(ControlPanelView, self).get_context_data(**kwargs)
  
          sg_user = SGCustomNonProjectEntity01.objects.filter(code=self.request.user.get_full_name())[0]
          projs = SGProject.objects.filter(Q(entities__entity_id=sg_user.id), Q(entities__type="CustomNonProjectEntity01"))
  
          context["assigned_projs"] = projs
  
          if self.request.method == "POST":
              form = ProjectAssignmentForm(projs, self.request.POST)
              if form.is_valid():
                   # update user projects logic
          else:
              form = ProjectAssignmentForm(projs)
  
          context["pas_form"] = form
  
          return context
  </code></pre>
  
  <p>template.html</p>
  
  <pre><code>&lt;div class="full_width" &gt;
      &lt;h4 class="no_pad" &gt;{{ user.first_name|upper }}'S CONTROL PANEL&lt;/h4&gt;
  &lt;/div&gt;
  
  &lt;div class="full_width top_tab"&gt;
      &lt;div class="border border_pad"&gt;
      &lt;h6&gt;PROJECTS YOU ARE ASSIGNED TO&lt;/h6&gt;
      {% if assigned_projs %}
          &lt;form action="/intranet/shotgun/" method="post"&gt;{% csrf_token %}
              &lt;div class="border_pad"&gt;
                  {{ pas_form.projects.errors }}
                  {{ pas_form.projects }}
                  &lt;input type="submit" value="Update" /&gt;
              &lt;/div&gt;
          &lt;/form&gt;
      {% else %}
          &lt;p&gt;You are not assigned to any projects.&lt;/p&gt;
      {% endif %}
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I have the csrf middleware enabled in my settings.py</p>
  
  <p>The behaviour I would expect from all this would be:</p>
  
  <p><li>Unbound form - display the page with pre-populated data</li>
  <li>Bound invalid - display the page with selected data</li>
  <li>Bound valid - display the page with updated data</li></p>
  
  <p>The unbound data page displays as expected but as soon as the post request is created by clicking the Update button on the form the a blank page is displayed. I tried throwing an exception after the <code>if self.request.method == "POST"</code> statement but the code doesn't seem to get this far. I'm really not sure what's going on.</p>