policies: sort groups in groupmembership policy and binding
closes #595 # Conflicts: # authentik/policies/group_membership/forms.py
This commit is contained in:
parent
e81d3dad3e
commit
a4d5815e1b
|
@ -2,6 +2,7 @@
|
|||
|
||||
from django import forms
|
||||
|
||||
from authentik.core.models import Group
|
||||
from authentik.lib.widgets import GroupedModelChoiceField
|
||||
from authentik.policies.models import Policy, PolicyBinding, PolicyBindingModel
|
||||
|
||||
|
@ -19,6 +20,9 @@ class PolicyBindingForm(forms.ModelForm):
|
|||
policy = GroupedModelChoiceField(
|
||||
queryset=Policy.objects.all().select_subclasses(),
|
||||
)
|
||||
group = forms.ModelChoiceField(
|
||||
queryset=Group.objects.all().order_by("name"), required=False
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
from django import forms
|
||||
|
||||
from authentik.core.models import Group
|
||||
from authentik.policies.forms import GENERAL_FIELDS
|
||||
from authentik.policies.group_membership.models import GroupMembershipPolicy
|
||||
|
||||
|
@ -9,6 +10,8 @@ from authentik.policies.group_membership.models import GroupMembershipPolicy
|
|||
class GroupMembershipPolicyForm(forms.ModelForm):
|
||||
"""GroupMembershipPolicy Form"""
|
||||
|
||||
group = forms.ModelChoiceField(queryset=Group.objects.all().order_by("name"))
|
||||
|
||||
class Meta:
|
||||
|
||||
model = GroupMembershipPolicy
|
||||
|
|
Reference in a new issue