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/flows/forms.py

47 lines
1.1 KiB
Python
Raw Normal View History

2020-05-08 17:46:39 +00:00
"""Flow and Stage forms"""
2019-10-07 14:33:48 +00:00
2020-05-08 16:29:18 +00:00
from django import forms
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.utils.translation import gettext_lazy as _
2020-05-08 17:46:39 +00:00
from passbook.flows.models import Flow, FlowStageBinding
2020-05-08 16:29:18 +00:00
class FlowForm(forms.ModelForm):
"""Flow Form"""
class Meta:
model = Flow
fields = [
"name",
"slug",
"designation",
2020-05-08 17:46:39 +00:00
"stages",
2020-05-08 16:29:18 +00:00
"policies",
]
widgets = {
"name": forms.TextInput(),
2020-05-08 17:46:39 +00:00
"stages": FilteredSelectMultiple(_("stages"), False),
"policies": FilteredSelectMultiple(_("policies"), False),
2020-05-08 16:29:18 +00:00
}
2020-05-08 17:46:39 +00:00
class FlowStageBindingForm(forms.ModelForm):
"""FlowStageBinding Form"""
2020-05-08 16:29:18 +00:00
class Meta:
2020-05-08 17:46:39 +00:00
model = FlowStageBinding
2020-05-08 16:29:18 +00:00
fields = [
"flow",
2020-05-08 17:46:39 +00:00
"stage",
2020-05-08 16:29:18 +00:00
"re_evaluate_policies",
"order",
"policies",
]
widgets = {
"name": forms.TextInput(),
2020-05-08 17:46:39 +00:00
"policies": FilteredSelectMultiple(_("policies"), False),
2020-05-08 16:29:18 +00:00
}