Hi,

Based on the following model

from django.models.auth import User

class PolicyCategory(meta.Model):
    name = meta.CharField(maxlength=100);
    users = meta.ManyToManyField(User, blank=True)

    class META:
        db_table = 'intranet_policies'
        module_name = 'policies'
        verbose_name_plural = 'policies'

i'm trying to get list of users with field lookups

>>> from django.models.auth import users
>>> from django.models.intranet import policycategories
>>>
>>> pc = policycategories.get_object(pk=1)
>>> pc.get_user_list(groups__name__exact='Tech')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/django/utils/functional.py",
line 3, in _curried
    return args[0](*(args[1:]+moreargs), **dict(kwargs.items() +
morekwargs.items()))
TypeError: method_get_many_to_many() got an unexpected keyword argument
'groups__name__exact'

Seems like get_xxx_list in many to many relations doesn't support
lookups ? Or is this a bug ? Cos if i do the following

>>> u = users.get_object(pk=1)
>>> u.get_intranet_policycategory_list(name__exact='Billing')
[Billing]

everything is working fine. Any hints on this, maybe i'm missing
something ?

Reply via email to