title: How to add an item to database directly in django without forms
body: <p>I know, this question has already been discussed, but I am unable to grab that.</p>
  <p>Here are two models I have</p>
  <pre><code># Create your models here.
  GENDER_CHOICES = [
      ('Male', 'M'),
      ('Female', 'F')]
  class upload(models.Model):
      name = models.CharField(max_length=100,null=True)
      gender = models.CharField(max_length=10,null=True, choices=GENDER_CHOICES)
      phone = models.CharField(max_length=50,null=True)
      email=  models.EmailField(max_length=50,null=True)
      file=models.FileField(upload_to='uploads/',null=True)
  
      def __str__(self):
          return self.name
  
  class text(models.Model):
      texts=models.CharField(max_length=200,null=True,blank=True)
      upload_text=models.ForeignKey(upload, blank=True, null=True, on_delete = models.CASCADE) 
  </code></pre>
  <p>I have a form for model <code>upload</code>. I inserted the data, and an audio file. Then I want this audio file to convert to text and save the text in the database.
  For that purpose, I created another model <code>text</code>.</p>
  <p>But I don't know how to insert the text to this model in relation to the information entered in model <code>upload</code></p>
  <p>Here is my views.py file function</p>
  <pre><code>def display(request):
      print('display functio')
      d=upload.objects.last()
      test=sr.takeCommand(d.file.path)
      print(test) **# I can see text here**
      p = text.objects.create(texts=test)
      p.save(force_insert=True)
      print(test)
      return render(request,'thanks.html',{'print':test})
  </code></pre>
  <p>But I am unable to enter it. It throws an error
  <code>UNIQUE constraint failed: sub_app_text.id</code></p>