On Mon, Feb 16, 2009 at 1:20 PM, Justin Lilly <justinli...@gmail.com> wrote: > > Hi Peter, > > While your proposed solution would work for the prototyping example > I've given, I have 3 more arching themes like Show and probably > another 4-5 content types like photo and articles. The main idea here > is to be able to select an arbitrary element, be it a photo, video, > article, etc. and display all of its related content, regardless of > content type, within the theme (aka Show).
Your M2M to self looks okay from a theoretical point of view, does it work in practice? >From a Pythonic point of view, you should be explicit, right? So, how well or how badly does it work if you have an FK on Item to self, named 'parent'? You can build trees mighty quickly that way. You might also want to look into Django-MPTT, which is designed to handle object graphs well. On a non-Python level, you might want to consider building a view in your db, and creating a model based on that view, rather than having Django build your tables. A bit more manual maintenance, and you might need to brush up on your SQL and relational design skills to get there, but it might be a direction to go. > As an ancillary goal, I > need to ensure I'm not generating a ton of expensive queries for each > of these lookups as this site will be serving a large number of users. > As far as I can tell, abstracting these relationships is the best way > to go about the problem, its just the method of abstraction that I'm > unsure on. "Premature optimization is the root of all evil." Don't worry about performance until you know it's a problem. Then solve it the normal way: figure out your caching strategy, tune your db to fit your server(s), profile. Don't assume that queries will be expensive a priori. Use select_related. You make your life harder by assuming bad performance before you know it occurs. See you tonight, ---Peter --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---