2009/7/14 The Danny Bos <danny...@gmail.com>:
>
> Hey there, this may not be appropriate, but I'm building in Django so
> here goes ...
>
> I'm creating an Interviews app/table in my Django 'Books' (test)
> project. Just wrapping my head around it before I start on my music
> based website ... Anyway,
>
> For my 'Interview' table, how would I assign an interview to an
> 'Author' or an 'Illustrator', as they both have separate tables
> themselves. Know what I mean? Seems crazy to choose either the Author
> from the list OR the Illustrator, how would I assign an Interview to
> either?
>
> Here's the layout for 'Interview':
>
> class Interview(models.Model):
>        body = models.TextField()
>        publication_date = models.DateField(auto_now=True)
>
>        author = models.ForeignKey('books.Author')
>        illustrator = models.ForeignKey('books.Illustrator')
>
>        class Meta:
>                ordering = ['publication_date']

One option would be to use a generic relation:

http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1

Regards,
Jonathan.

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to