On Sun, Aug 23, 2009 at 11:00 PM, Andrea Zilio<m.ep...@gmail.com> wrote: > > Great, but that wasn't exactly what I was looking for. > > What I need is a way to get the right instances from a *single* query. > > This means that I should do LEFT JOINS on direct subclasses of the > base class. > > What I need to know is if this is somehow possible without editing the > Django core, but using some signals ore something else.
When I said before that it was possible to emulate this in user space, I meant you could do something like the following: * Add a klass column to your base model. * On subclasses, populate this column with a class-specific identifying value. * Add a narrow() function (naming borrowed from CORBA) on the base class that uses the value of klass to determine the subclass instance that needs to be retrieved * Whenever you need a list of subclasses, use a list comprehension that incorporates narrow: [ obj.narrow() for obj in BaseClass.objects.all() ] It's not spectacularly efficient - it does lots of joins and lots of database traffic, but it works. > Or if this is planned for some future release. As I said previously, this isn't planned for a future release - in fact, it's planned that we _wont_ do this. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---