title: IntegrityError at * UNIQUE constraint failed
body: <p>I am trying to create a django application to keep track of a product(product stock application).whenever I try to add new product ,I cannot add more than one product in the same category. It gives <strong>UNIQUE constraint failed</strong> error .</p>
  <p>
  I want to add multiple products in same category.
  </p>
  models.py
  <pre><code>from django.db import models
  
  
  class Category(models.Model):
      name = models.CharField(max_length=100, blank=True, null=True)
  
      def __str__(self):
          return self.name
  
  
  class Product(models.Model):
      name = models.CharField(max_length=100)
      slug = models.CharField(max_length=100)
      price = models.DecimalField(max_digits=6, decimal_places=2)
      quantity = models.IntegerField(null=True, blank=True)
      category = models.ForeignKey(
          Category, on_delete=models.CASCADE)
  
      def __str__(self):
          return self.name
  
  
  class Stock(models.Model):
      sold_quantity = models.IntegerField(null=True, blank=True)
      product = models.ForeignKey(Product, on_delete=models.CASCADE, null=True)
  
      def __str__(self):
          return self.product.name
  </code></pre>
  <p><strong>Edit:</strong></p>
  <p><strong>Views</strong></p>
  <pre><code>def createProduct(request):
      form = AddProductForm()
      if request.method == 'POST':
          form = AddProductForm(request.POST)
          if form.is_valid():
              form.save()
              return redirect('/')
      contex = {'form': form}
      return render(request, 'stockmgmt/add_products.html', contex)
  </code></pre>
  <p><strong>Forms.py</strong></p>
  <pre><code>class AddProductForm(ModelForm):
      class Meta:
          model = Product
          fields = '__all__'
  </code></pre>
  <p><strong>Error Message</strong>
  <a href="https://i.stack.imgur.com/C3Vaf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C3Vaf.jpg" alt="Error Message" /></a></p>