Sorry, think I've answered my own question: Further searching found a
similar request in developers a couple of months back:

http://groups.google.com/group/django-developers/browse_thread/thread/ef2d981e49ba1b4d/a4c531b8b4880cd0

Which didn't get any love. So I guess I'll need to drop in to SQL for
now.

On Aug 14, 4:34 pm, NickJ <[EMAIL PROTECTED]> wrote:
> Take 3 models:
>
> class Publisher(models.Model):
>     name = models.CharField()
>
> class Author(models.Model):
>     name = models.CharField()
>
> class Book(models.Model):
>      publisher = models.ForeignKey(Publisher)
>      authors = models.ManyToManyField(Author)
>
> i.e. a book must have one or more authors, and must have one
> publisher.
>
> What i want is to get a distinct list of all authors for a specific
> publisher. Is this possible without dropping back to raw SQL?
>
> I want to do something like:
>
> p = Publisher.objects.get(pk=1)
> list = p.book_set.values('publisher__id', 'publisher__name').distinct()


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