On Tue, Aug 25, 2009 at 10:41 AM, Carl Meyer<carl.j.me...@gmail.com> wrote: > > > > On Aug 23, 9:14 pm, Andrea Zilio <m.ep...@gmail.com> wrote: >> So the answer to the question "Can I get the right instances with one >> single and only DB query" seems to be: >> "No, you cannot do so without touching the Django orm code". >> >> Am I right? > > Actually, I think the ORM's extensibility mechanisms are sufficient > that you could provide your QuerySet.select_subclasses() method, which > would perform a single query with n LEFT JOIN's, with custom QuerySet/ > Query subclasses. Writing it would certainly require a non-trivial > level of familiarity with the ORM internals, and you might have to use > private APIs - but I don't think you'd have to modify Django code. > > Carl > > >
Actually there's already a ticket to cover the ability to do that type of joining. Ticket 7270 works to add select_related support to reverse 1-1 relations, which is all that inheritance is. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." -- Voltaire "The people's good is the highest law." -- Cicero "Code can always be simpler than you think, but never as simple as you want" -- Me --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---