Opened 11 years ago

Closed 11 years ago

#5572 closed (invalid)

Can't have empty fixture file with Auto Increment Field in Model

Reported by: anonymous Owned by: nobody
Component: Core (Serialization) Version: master
Severity: Keywords: empty fixture file json serialization auto increment
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


You can't have a empty fixture file when model has Auto Increment Field.

class Category(models.Model):

id = models.AutoField(primary_key=True)
parent_id = models.IntegerField()
name = models.CharField(maxlength=200)

Problem installing fixture 'c:\mysite\apps\category\fixtures
\initial_data.yaml': 'NoneType' object has no attribute 'anchor'

This error is due to auto incremented primary key. you can't have
empty fixture file.

Change History (1)

comment:1 Changed 11 years ago by James Bennett

Resolution: invalid
Status: newclosed

If you mean your fixture file is completely empty, then it's not a fixture at all and you shouldn't be trying to load it. Re-open with clarification if this isn't what you're trying to do.

Note: See TracTickets for help on using tickets.
Back to Top