Hi Mike,

As we look at selected_choice result from iterating v over value (line
428), option_value base on choice(line 438).
so we can limit input parameter of value variable from this def().

Hope if heplful.



On Sat, Jan 4, 2020, 11:00 Mike Dewhirst <[email protected]> wrote:

> In the Admin where user group membership is shown and groups can be
> selected from choices derived from auth_groups, I want to control the
> available choices.
>
> It seems the place to do so might be in admin/widgets.py in the
> AutocompleteMixin.optgroups() method a few lines in where it says ...
>
>          choices = (
>              (obj.pk, self.choices.field.label_from_instance(obj))
>              for obj in
> self.choices.queryset.using(self.db).filter(pk__in=selected_choices)
>          )
>
> Could a very kind person explain to me how I can hijack this and remove
> a couple of groups from the resulting choices?
>
> My use case is that I want members of the 'admin' group to be able to
> assign any group membershipto any other userexcept for a couple of
> groups which are too permissive. The excepted groups can only be
> assigned by a Superuser.
>
> Many thanks for any hints
>
> Cheers
>
> Mike
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/52923a2a-cc6c-e335-f5fe-6ec6ab004013%40dewhirst.com.au
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP5HUWoZ14gH%3D8V1ARk-pnAKNWuVaqG%3D4%3DGSbwO_-0LrP7DFnw%40mail.gmail.com.

Reply via email to