Reputation: 3
I want to fill a choice field with users who are not staff. I am using an extended user class (with a OneToOneField as mentioned in django docs):
class Usuario(models.Model):
user = models.OneToOneField (User)
departamento = models.ForeignKey(Departamento, null=True)
Then,
class Proyecto(models.Model):
ip = models.ForeignKey(Usuario, limit_choices_to = {'user.is_staff__exact': False }, related_name='pr_ip') # not working!
jp = models.ForeignKey(Usuario, limit_choices_to = {'departamento__isnull': False }, related_name='pr_jp') # works!
The problem is that I cannot use user.is_staff field to filter. Any idea about how to fix this or how to do it?
Upvotes: 0
Views: 72