Say I have two model classes, one of which is a sub-class of the other:

class Place(models.Model):
  ...

class Restaurant(Place):
  objects = models.Manager()
  ...

[Note, I'm using model inheritance here, **not** a OneToOneField. The
explicit assignment of 'objects' seems to be necessary or
Resaurant.objects.all() returns a list of Place objects?!?]

Instances of Place will be stored in one table, and instances of Restaurant
will be stored in another table. How would I go about implementing an
efficient 'extent' query: a QuerySet which would give me an instance of
Place for each row in **both** tables? (Or instances of Place or Restaurant
as appropriate, but all in one query set.)

Ideally, I'd like to be able to say things like:

Place.objects.extent() # get all places/restraunts
Place.objects.extent().filter(...) # select sub-set across both types

etc. The only idea I have so far is to create a composite QuerySet
implementation and a custom manager, which sounds like a fair bit of work :-)


Is there anything like this already in Django?

L.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to