I don't know how to import a json fixture that uses a foreign key.
Searching the forums and web wasn't helpful for me to find specifics,
so I hoep someone can point out my silly mistake.
Hers's my example json:
[
{"pk": "0", "model": "polls.Choice", "fields": { "choice": "I like
vegetables", "votes": "0"}}
]
But the error I get is:
Problem installing fixture '/Users/admin/projects/django/tutorials/
tutorial1/../tutorial1/polls/fixtures/polls.json':
polls_choice.poll_id may not be NULL
I'm working through the basic tutorial, where the models.py is:
class Choice(models.Model):
poll = models.ForeignKey(Poll, edit_inline=models.STACKED,
num_in_admin=3)
choice = models.CharField(maxlength=200, core=True)
votes = models.IntegerField(core=True)
class Poll(models.Model):
question = models.CharField(maxlength=200)
pub_date = models.DateTimeField('date published')
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---