On Saturday 01 May 2010 10:54:52 pm Kenneth Gonsalves wrote: > I have a model called 'Team' with a manytomany field to 'Player'. How do I > select all the players who are not in any team? I remember doing this > once, but cannot find what I did. >
I have tried this: self.fields['members'].choices = [(x.id,x.name) for x in Player.objects.all() if x.team_set.all() == []] does not seem very elegant -- regards Kenneth Gonsalves Senior Associate NRC-FOSS http://certificate.nrcfoss.au-kbc.org.in -- 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.

