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

44 lines
1.3 KiB
Python
Raw Normal View History

2018-11-26 21:09:04 +00:00
"""passbook Core Application forms"""
from django import forms
from django.contrib.admin.widgets import FilteredSelectMultiple
2019-02-21 15:06:57 +00:00
from django.utils.translation import gettext_lazy as _
2018-11-26 21:09:04 +00:00
2018-12-09 22:05:55 +00:00
from passbook.core.models import Application, Provider
2018-11-26 21:09:04 +00:00
class ApplicationForm(forms.ModelForm):
"""Application Form"""
2019-12-31 11:51:16 +00:00
provider = forms.ModelChoiceField(
queryset=Provider.objects.all().order_by('pk').select_subclasses(), required=False
2019-12-31 11:51:16 +00:00
)
2018-12-09 22:05:55 +00:00
2018-11-26 21:09:04 +00:00
class Meta:
model = Application
2019-12-31 11:51:16 +00:00
fields = [
"name",
"slug",
"skip_authorization",
2019-12-31 11:51:16 +00:00
"provider",
"meta_launch_url",
"meta_icon_url",
"meta_description",
"meta_publisher",
2019-12-31 11:51:16 +00:00
"policies",
]
2018-11-26 21:09:04 +00:00
widgets = {
2019-12-31 11:51:16 +00:00
"name": forms.TextInput(),
"meta_launch_url": forms.TextInput(),
"meta_icon_url": forms.TextInput(),
"meta_publisher": forms.TextInput(),
2019-12-31 11:51:16 +00:00
"policies": FilteredSelectMultiple(_("policies"), False),
2018-11-26 21:09:04 +00:00
}
2019-02-21 15:06:57 +00:00
labels = {
"meta_launch_url": _("Launch URL"),
"meta_icon_url": _("Icon URL"),
"meta_description": _("Description"),
"meta_publisher": _("Publisher"),
2019-02-21 15:06:57 +00:00
}
help_texts = {"policies": _("Policies required to access this Application.")}