Hi,

I'm wondering what the best/canonical way is to gather the set of
related objects for each of a number of objects, going across a
Many-to-Many relationship.  Here's an example, since that probably
didn't make sense by itself:

class Label(Model):
  name = CharField(...)

class Email(Model):
  sender = CharField(...)
  body = CharField(...)
  labels = ManyToManyField(Label)

Now I want to retrieve all emails sent by "showard" along with all the
labels applied to each email.  I want to do it with a *constant*
number of database queries.  How do I do it?

Thanks,
Steve

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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