Re: new at this -- need some guidance
On Sat, Sep 10, 2011 at 8:36 PM, Danny Gale <danny.m.gale@gmail.com> wrote:
> Daniel, thank you very much. That's extremely helpful.
>
> What I'm trying to define is that every song can be on one album, but each
> album can (of course) have many songs. For that, would it be better to use
> the ManyToMany from Album to song or FK from song to album?
If a song can only belong to one album, you don't have a many-to-many
relationship between songs and albums, you have a many-to-one
relationship. In Django, you use ForeignKey to define this (on the
Song model).
Check out https://docs.djangoproject.com/en/dev/topics/db/models/#many-to-one-relationships
if you're curious.
Cheers,
Martin Melin
--
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