I'm not sure if my problem is related to this thread[1] or if I'm just
misunderstanding something with regard to limit_choices_to.

First I tried this (in relevant part):

from django.contrib.auth.models import User

class Project(models.Model):
    coordinator = models.ForeignKey(
        User,
        limit_choices_to={'id__in' :
User.objects.filter(groups__name='Coordinator')}
    )

As explained in the previously referenced thread, that currently
doesn't work so I tried this:

from django.contrib.auth.models import User, Group

def users_in_group(group):
    g = Group.objects.get(name=group)
    return User.objects.filter(groups=g)

class project(models.Model):
    ...
        limit_choices_to={'id__in' : users_in_group('Coordinator')}
    ...

but that generates the same error. The Docs say I can use any Q
object, so I understood that to mean either of the above should work.
Am I using limit_choices_to is ways it's not intended or should I wait
for the previously mentioned bugs to be worked out?

[1] 
http://groups.google.com/group/django-users/browse_thread/thread/6460e63e0e6c88d8/
-- 
----
Waylan Limberg
[EMAIL PROTECTED]

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

Reply via email to