#20820 closed Bug (fixed)
Loaddata on dumpdata'd subclass fails
| Reported by: | Owned by: | Tim Graham | |
|---|---|---|---|
| Component: | Core (Serialization) | Version: | 1.6-beta-1 |
| Severity: | Release blocker | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I have a problem with loaddata on a subclass of contrib.auth.User. The dumpdata generates data that looks fine. The JSON I get is identical to Django 1.5 which loads just fine. Loaddata in 1.6b1 fails to load that data, however. I get the impression that it is caused by subclassing, as none of the other relations in the models cause trouble. I have attached a small sample project with just the subclass to reproduce the problem ("sample.zip").
Loaddata crashes with this exception ValueError: Problem installing fixture '/Volumes/prj/myapp/fixtures/ennu.json': "<MiniUser: >" needs to have a value for field "user" before this many-to-many relationship can be used. (This is the user-permission related manager complaining, by the way)
This is what the MiniUser model looks like:
class MiniUser(User):
mini = models.IntegerField()
This is a snippet from dumpdata:
...
{
"pk": 1,
"model": "myapp.miniuser",
"fields": {
"user_permissions": [],
"mini": 123,
"groups": []
}
...
When I remove the "user_permissions" and "groups" properties (from auth.User) from the myapp.miniuser json, loaddata completes just fine.
Attachments (2)
Change History (7)
by , 12 years ago
| Attachment: | sample.zip added |
|---|
comment:1 by , 12 years ago
| Component: | Uncategorized → Core (Serialization) |
|---|---|
| Owner: | changed from to |
| Severity: | Normal → Release blocker |
| Status: | new → assigned |
| Triage Stage: | Unreviewed → Accepted |
| Type: | Uncategorized → Bug |
I can reproduce this and it indeed appears to be a regression in 1.6.
comment:2 by , 12 years ago
Added a regression test. The commit that introduced the issue is 97774429aeb54df4c09895c07cd1b09e70201f7d.
comment:3 by , 12 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
minimal sample project for reproduction