Russ, Really useful response, thanks.
I had thought about your third option but as I figured there'd be a lot of empty fields I didn't give it much consideration. I might actually go down that route until I have a better understanding of generic relations. Thanks again. j. On Jun 29, 2:20 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 6/28/07, Jamie Pittock <[EMAIL PROTECTED]> wrote: > > > > > I don't want to code myself into a corner, so when I start looking at > > features such as allowing users to search all venues would I be best > > with one parent model or will I be ok keeping them separate? The > > different types of venues have quite a number of different attributes > > btw which is why they are different models rather than simply > > categoried. > > Model inheritance sounds good on paper, but in practice, it gets > somewhat inconvenient - lots of table joins to get at basic > attributes, etc. If you have very few common attributes anyway, > generic relations are probably worth investigation. > > However, as always, YMMV. My only reservation in recommending generic > relations is that they aren't fully integrated with admin yet (though > there is a patch floating around to integrate them with > newforms-admin), and they're not fully documented. However, if you're > willing to put up with those limitations, it sounds like they could be > a good match for your needs. > > A third approach that you haven't mentioned is to have a single > 'object' table that is sparse; i.e., instead of > > class Bar(Model): > name = CharField() > number_of_bartenders = IntegerField() > > class Club(Model): > name = CharField() > music_style = CharField() > > you have a single model that has all the fields: > > class Venue(Model): > name = CharField() > venuetype = CharField(choices=(('b','bar'),('c','club')) > number_of_bartenders = IntegerField(null=True) > music_style = CharField(null=True) > > This way you spend a little more time in data validation (making sure > that you have all the columns that you need for any given row), and > you waste a little space in the database, but lookups will be a little > faster (as no joins are required). > > Yours, > Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---