This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/policies/forms.py
2020-09-30 19:34:22 +02:00

27 lines
728 B
Python

"""General fields"""
from django import forms
from passbook.lib.widgets import GroupedModelChoiceField
from passbook.policies.models import Policy, PolicyBinding, PolicyBindingModel
GENERAL_FIELDS = ["name"]
GENERAL_SERIALIZER_FIELDS = ["pk", "name"]
class PolicyBindingForm(forms.ModelForm):
"""Form to edit Policy to PolicyBindingModel Binding"""
target = GroupedModelChoiceField(
queryset=PolicyBindingModel.objects.all().select_subclasses(),
to_field_name="pbm_uuid",
)
policy = GroupedModelChoiceField(
queryset=Policy.objects.all().select_subclasses(),
)
class Meta:
model = PolicyBinding
fields = ["enabled", "policy", "target", "order", "timeout"]