2020-05-08 18:46:39 +01:00
|
|
|
"""Flow and Stage forms"""
|
2019-10-07 15:33:48 +01:00
|
|
|
|
2020-05-08 17:29:18 +01:00
|
|
|
from django import forms
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
|
2020-05-08 18:46:39 +01:00
|
|
|
from passbook.flows.models import Flow, FlowStageBinding
|
2020-05-08 17:29:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
class FlowForm(forms.ModelForm):
|
|
|
|
"""Flow Form"""
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
|
|
|
model = Flow
|
|
|
|
fields = [
|
|
|
|
"name",
|
|
|
|
"slug",
|
|
|
|
"designation",
|
|
|
|
]
|
2020-05-13 10:57:10 +01:00
|
|
|
help_texts = {
|
|
|
|
"name": _("Shown as the Title in Flow pages."),
|
|
|
|
"slug": _("Visible in the URL."),
|
|
|
|
"designation": _(
|
|
|
|
(
|
|
|
|
"Decides what this Flow is used for. For example, the Authentication flow "
|
|
|
|
"is redirect to when an un-authenticated user visits passbook."
|
|
|
|
)
|
|
|
|
),
|
|
|
|
}
|
2020-05-08 17:29:18 +01:00
|
|
|
widgets = {
|
|
|
|
"name": forms.TextInput(),
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-08 18:46:39 +01:00
|
|
|
class FlowStageBindingForm(forms.ModelForm):
|
|
|
|
"""FlowStageBinding Form"""
|
2020-05-08 17:29:18 +01:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
2020-05-08 18:46:39 +01:00
|
|
|
model = FlowStageBinding
|
2020-05-08 17:29:18 +01:00
|
|
|
fields = [
|
|
|
|
"flow",
|
2020-05-08 18:46:39 +01:00
|
|
|
"stage",
|
2020-05-08 17:29:18 +01:00
|
|
|
"re_evaluate_policies",
|
|
|
|
"order",
|
|
|
|
]
|
2020-05-30 21:36:01 +01:00
|
|
|
labels = {
|
|
|
|
"re_evaluate_policies": _("Re-evaluate Policies"),
|
|
|
|
}
|
2020-05-08 17:29:18 +01:00
|
|
|
widgets = {
|
|
|
|
"name": forms.TextInput(),
|
|
|
|
}
|