I have a Django blog with a "Post" model like so:
class Post(models.Model):
title = models.CharField(max_length=1000)
author = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
text = models.TextField(max_length=10000)
CATEGORY_CHOICES = (
('breakfast','Breakfast'),
('brunch','Brunch'),
...
)
category = models.CharField(max_length=100,blank=True,choices=CATEGORY_CHOICES)
I have uploaded a bunch of "Post" objects (with all of the above fields completed) to my database using the python manage.py loaddata fixturename.json
command. However, when I log into the admin site to modify the objects, the values I uploaded for the "category" field do not show up as pre-selected in the field's drop-down list. Why is this? And is there any way to fix it?
EDIT: Here is snippet from my json fixture file:
{
"pk": 34,
"model": "blogs.post",
"fields": {
"category": "breakfast",
"author": "jennaboller",
"text": "I have to say, my favorite weekend breakfast is blah blah blah",
"title": "Corned Beef Hash & Eggs: My Favorite Weekend Breakfast",
"pub_date": "2011-01-25 05:05:37"
}