the fixture data for my blog app using JSON. Everything works
correctly until I try to set up 'tags' on a 'post' which is a
ManyToManyField. When I run '>>> python manage.py sqlall blog' and
check out the proposed SQL, the table 'blog_post_tags' is listed and
defined correctly. However, when I try to run '>>>python manage.py
syncdb' I am met with the error: 'DatabaseError: no such table:
blog_post_tags'.
model:
class Tag(models.Model):
title = models.CharField(max_length=30)
date_created = models.DateField(auto_now_add=True)
date_updated = models.DateField(auto_now=True)
class Post(models.Model):
...
tags = models.ManyToManyField(Tag)
...
fixture:
[{
"model": "blog.Post",
"pk": 1,
"fields": {
"title": "Demo Post 1",
"category": 3,
"tags": [1],
"body": "This is a sample body.",
"is_published": "1",
"date_created": "2012-01-28",
"date_updated": "2012-01-28"
}
}]
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment