You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Oke, so, thats a weird one, I think. I get an IntegrityError when I try to load fixtures if I use inheritance and an m2m field:
django.db.utils.IntegrityError: Problem installing fixture '/path/to/foobar/fixtures/foobar.json': Could not load foobar.Person(pk=1): NOT NULL constraint failed: foobar_historicalperson.id
This happens when I use both multi table inheritance and I set the _history_m2m_fields.
class Root(models.Model):
pass
class Profession(models.Model):
name = models.CharField(max_length=8)
class Person(Root):
_history_m2m_fields = ["profession"]
profession = models.ManyToManyField(Profession, blank=True)
history = HistoricalRecords()
I created the instance by running:
pro = Profession.objects.create()
p = Person.objects.create()
p.profession.add(pro)
then I dumped the fixture using dumpdata foobar. When I try to load the fixture I get the error above.
Expected behavior
No IntegrityError, but the data imported.
Environment (please complete the following information):
OS: Debian unstable
Django Simple History Version: 3.7.0
Django Version: 5.0.6
Database Version: sqlite 3.40
The text was updated successfully, but these errors were encountered:
b1rger
added a commit
to acdh-oeaw/apis-core-rdf
that referenced
this issue
Jun 18, 2024
Describe the bug
Oke, so, thats a weird one, I think. I get an
IntegrityError
when I try to load fixtures if I use inheritance and an m2m field:This happens when I use both multi table inheritance and I set the
_history_m2m_fields
.To Reproduce
I have pushed a minimal reproducer to https://github.com/b1rger/dsh-reproducer
I have the following
models.py
:I created the instance by running:
then I dumped the fixture using
dumpdata foobar
. When I try to load the fixture I get the error above.Expected behavior
No IntegrityError, but the data imported.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: