How do I get a distinct list of values from a manytomany field????

Using a foreign key it is straightforward:

RA_CHOICES = DesignSet.objects.values('project__RA').distinct()

project is a foreignkey field.


but trying the same on a m2m field raises an error:

Designer_CHOICES =
DesignSet.objects.values('contributor__last_name').distinct()

Invalid field name: 'contributor__last_name'

Here contributor is a manytomany fieldfield.

In the django docs it states:
The values() method does not return anything for ManyToManyField
attributes and will raise an error if you try to pass in this type of
field to it.

This is fair enough but how you would go about obtaining a list of
distinct values from a m2m field?????


Any help would be very much appreciated as I have tried all sorts of
things but with no success!

Regards, Martin



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