loaddata and m2m backend tables...
Hi,
I used loaddata to insert some data into my app - now all my model
related tables are correctly populated.
How do I fill in the many to many tables, since there isn't a model
that directly represents those tables?
I found this: http://www.b-list.org/weblog/2007/nov/21/install-time/
but it suggested "use loaddata", which hasn't worked for me...
ie:
class Book(models.Model):
title = models.CharField(max_length=100)
publisher = models.CharField(max_length=40)
date = models.IntegerField()
place = models.CharField(max_length=20)
pages = models.IntegerField(blank=True, null=True)
authors = models.ManyToManyField(Author)
class Writer(models.Model):
first = models.CharField(u'First Name', max_length=30)
other = models.CharField(u'Other Names', max_length=30, blank=True)
last = models.CharField(u'Last Name', max_length=30)
dob = models.DateField(u'Date of Birth', blank=True, null=True)
class Meta:
abstract = True
class Author(Writer):
language = models.CharField(max_length=20, choices=LANGUAGES, blank=True)
books_book and books_author are fine...but how do I populate books_book_authors?
cheers
L.
--
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home