title: Getting "cursor "_django_curs_140244427998976_3" does not exist" error
body: <p>I am creating modelforms. I have managed to pull the fields i want to use from my tables (using postgresql):</p>
  
  <p>Table:</p>
  
  <pre><code>class Response(models.Model):
      Question = models.ForeignKey(Question, on_delete=models.CASCADE)
      Topic = models.ForeignKey(Topic, on_delete=models.CASCADE)
      Response = models.TextField()
      Client = models.ForeignKey(ClientDetail, on_delete=models.CASCADE)
      Planit_location = models.ForeignKey(Planit_location, on_delete=models.CASCADE)
  
      def __str__(self):
          return self.Response
  </code></pre>
  
  <p>Form:</p>
  
  <pre><code>class ResponseForm(forms.ModelForm):
      class Meta:
          model = Response
          fields = ('Response', 'Topic', 'Client')
          widgets = {
             'Response': Textarea(attrs={'rows':3, 'cols':200}),
          }
  </code></pre>
  
  <p>I want to now add in the Planit_locaiton field, but when i do i get the cursor error as stated in the title. Not sure why. Here is the Location table:</p>
  
  <pre><code>class Planit_location(models.Model):
      Planit_location = models.CharField(max_length=255)
  
      def __str__(self):
          return self.Planit_location
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code> &lt;form method="post" name="uploadform" style="margin-left: 16px"&gt;
      {% csrf_token %}
      &lt;h4&gt;Add Data&lt;/h4&gt;
      &lt;table&gt;
              {{ qform.as_table }}
              {{ rform.as_table }}
      &lt;/table&gt;
      &lt;button type="submit" class="btn btn-default"&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>views.py:</p>
  
  <pre><code>def adddata(request):
  if request.user.is_authenticated:
      username = request.user.username
  
  if request.method == 'POST':
      qform = QuestionForm(request.POST)
      rform = ResponseForm(request.POST)
      if qform.is_valid() and rform.is_valid():
          qf = qform.save()
          rf = rform.save(commit=False)
          rf.Question = qf
          rf.save()
          return render(request, 'app/adddatatest.html', {
             "qform": QuestionForm(),
             "rform": ResponseForm(),
             "username": username,
          })
  else:
      qform = QuestionForm()
      rform = ResponseForm()
  return render(request, 'app/adddatatest.html', {
      "qform": QuestionForm(),
      "rform": ResponseForm(),
      "username": username,
  })
  </code></pre>
  
  <p>EDIT</p>
  
  <p>Traceback:</p>
  
  <pre><code>db_1             | 2018-09-21 15:35:12.284 UTC [58] ERROR:  relation "app_planit_location" does not exist at character 153
  db_1             | 2018-09-21 15:35:12.284 UTC [58] STATEMENT:  DECLARE 
  "_django_curs_140423080417024_3" NO SCROLL CURSOR WITH HOLD FOR SELECT "app_planit_location"."id", "app_planit_location"."Planit_location" FROM "app_planit_location"
  db_1             | 2018-09-21 15:35:12.285 UTC [58] ERROR:  cursor "_django_curs_140423080417024_3" does not exist
  db_1             | 2018-09-21 15:35:12.285 UTC [58] STATEMENT:  CLOSE "_django_curs_140423080417024_3"
  
  Exception Type: OperationalError at /adddata/
  Exception Value: cursor "_django_curs_140244427998976_3" does not exist
  </code></pre>