Code

Opened 7 years ago

Closed 7 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: UI/UX:

Description

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.

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.