Opened 7 years ago
Closed 5 years ago
#28725 closed Bug (fixed)
In multi-table inheritance, serializers output ManyToManyFields in both the parent and the base class which causes an error with loaddata
Reported by: | 宅教授 | Owned by: | Nadege |
---|---|---|---|
Component: | Core (Serialization) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
models:
class Root(Model): varchar_field_a many_to_many_field class Sub(Root): varchar_field_b
cmd: python manager.py dumpdata
, output:
[ { "pk": 1, "model": "label.sub", "fields": { "varchar_field_b": "b", "many_to_many_field": [...] } }, ... ]
The point is, its export the many-to-many field in the parent class.
cmd: python manager.py loaddata
, import the above data. Triggered by repeated import many-to-many data uniqueness constraints.
Change History (5)
comment:1 by , 7 years ago
Summary: | The serializer will output the many-to-many field in the parent class. → In multi-table inheritance, serializers output ManyToManyFields in both the parent and the base class which causes an error with loaddata |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 5 years ago
Has patch: | set |
---|
comment:4 by , 5 years ago
Triage Stage: | Accepted → Ready for checkin |
---|---|
Version: | 1.11 → master |
Note:
See TracTickets
for help on using tickets.
hi here is the patch PR
Not sure about the release it should target though.