On Mon, 2006-07-24 at 01:52 +0000, [EMAIL PROTECTED] wrote:
> I'm completely new to Django and relatively new to databases, so
> forgive me if this is a naive or stupid question.
> 
> I'm designing a site for a radio station, and some models seem to have
> much wider scope than others.  For example, I want to create a playlist
> app and a schedule app.  Both need access to the 'show' and 'dj' tables
> in the database, but the schedule app doesn't care about specific
> songs.  Can models in one app inherit models in another, or is this
> Django's way of suggesting that the schedule and playlist should really
> just be merged into one app?  I don't have my heart set on any
> particular arrangement of data, I'm really just trying to find out the
> Right Way to deal with more and less specific data.  Is there some way
> to structure the data hierarchically?

You don't really want model inheritance here (since that usually implies
an "is a" relationship between the two things and a "playlist" is not a
"dj"). Instead, you can happily use relations between the tables such as
many-to-one (the ForeignKey field) or many-to-many (ManyToManyField).

So if each playlist can only have a single dj, a ForeignKey in the
playlist model to the dj model would do the trick.

You can do relations between models in different apps. All that is
documented in the model-api.txt file (although, to be honest, it behaves
exactly as you would expect: import the remote model and refer to it).

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to