List Info

Thread: limit)choices_to and OneToOne field affecting admin




limit)choices_to and OneToOne field affecting admin
country flaguser name
United States
2007-06-28 07:52:51
Hi,

I have a model that has a OneToOneField to User and a
limit_choices_to
parameter set:

class Profile(models.model):
[---tab---] user = models.OneToOneField(User,
limit_choices_to={'is_staff':True})

When I use this is_staff parameter, I can only see staff
users when I
log in to the Django admin and try to edit users by clicking
on the
Users link.  Why would a limit_choices_to parameter on
another model
impact the User model administration?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: limit)choices_to and OneToOne field affecting admin
country flaguser name
United States
2007-06-28 08:08:15
Found it.  In line 745 and 746 in main.py in
django/contrib/admin/
views

        if self.opts.one_to_one_field:
            qs =
qs.complex_filter(self.opts.one_to_one_field.rel.limit_choic
es_to)

What was the thought behind this, and why wouldn't this be
optional?

On Jun 28, 8:52 am, Joe <josephdr...gmail.com> wrote:
> Hi,
>
> I have a model that has a OneToOneField to User and a
limit_choices_to
> parameter set:
>
> class Profile(models.model):
> [---tab---] user = models.OneToOneField(User,
> limit_choices_to={'is_staff':True})
>
> When I use this is_staff parameter, I can only see
staff users when I
> log in to the Django admin and try to edit users by
clicking on the
> Users link.  Why would a limit_choices_to parameter on
another model
> impact the User model administration?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )