text: Opened 9 years ago
  Closed 9 years ago
  #8463 closed (invalid)
  force_insert doesn't work with inherited models
  Description
  The following testcase describes the problem best:
  Model:
  from django.db import models class Parent(models.Model): something = models.SlugField() class Daughter(Parent): pass
  Interactive session:
  In [1]: from appname.models import Daughter In [2]: d = Daughter(something='algo') In [3]: d.save() In [4]: d.something='otra' In [5]: d.save(force_insert=True)
  results in
  IntegrityError: duplicate key value violates unique constraint "appname_daughter_pkey"
  Change History (1)
  comment:1 Changed 9 years ago by
  Note: See TracTickets for help on using tickets.
  That's not a bug, it's exactly the right behaviour. You created
  dand then you try to save it with updated data (the primary key will still be the same), but say you want to force an insert. The database says the record already exists with that primary key value.