title: FOREIGN KEY constraint failed error in Django sqlite3
body: <p>I am working on a script where I created a status model. User can create new status. I have checked the other answers for this but they all seemed code specific.</p>
  
  <p>This is <code>models.py</code>:</p>
  
  <pre><code>class wall_status(models.Model):
      status = models.OneToOneField(
          CustomUser,
          on_delete=models.CASCADE,
          primary_key=True,
      )
      user = models.ForeignKey(
          settings.AUTH_USER_MODEL,
          related_name="custom_student_status",
          default=1, 
          on_delete=models.CASCADE)
      new_status = models.CharField(max_length=2000, default='')
  </code></pre>
  
  <p>This is <code>forms.py</code>:</p>
  
  <pre><code>class statusForm(forms.ModelForm):
      new_status = forms.CharField( widget=forms.Textarea)
      class Meta:
          model = wall_status
          fields = ('new_status', )
  </code></pre>
  
  <p>This is my <code>views.py</code>:</p>
  
  <pre><code>def add_status(request):
      if request.method == "POST":
          form = statusForm(request.POST)
          if form.is_valid():
              post = form.save(commit=False)
              post.user = request.user
              post.save()
              return redirect('wall')
      else:
          form = statusForm()
      btn = 'Add'
      title = 'Interests'
      return render(request, 'user/profile_info_update.html', {'form': form, 'btn': btn, 
                                                                  'title': title})
  </code></pre>
  
  <p>This is template:</p>
  
  <pre><code>{% block content %}
            &lt;h2&gt;Sign up&lt;/h2&gt;
           &lt;form method="post" enctype="multipart/form-data"&gt;
                {% csrf_token %}
                {{ form.as_p }}
                &lt;button type="submit"&gt;{{ btn }}&lt;/button&gt;
              &lt;/form&gt;
          {% endblock %}
  </code></pre>
  
  <p>Now whats more confusing here is that I was able to add the records in database successfully 5 times and after that it started giving the error. If I manually remove a record and then add from <code>runserver</code> again it works but as soon as number of record in table is 5, I get the error. Any ideas?</p>
  
  <p>Thanks</p>