2018-11-26 21:09:04 +00:00
|
|
|
"""passbook Core Application forms"""
|
|
|
|
from django import forms
|
2019-03-10 17:34:09 +00:00
|
|
|
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-02-21 16:01:12 +00:00
|
|
|
provider = forms.ModelChoiceField(queryset=Provider.objects.all().select_subclasses(),
|
|
|
|
required=False)
|
2018-12-09 22:05:55 +00:00
|
|
|
|
2018-11-26 21:09:04 +00:00
|
|
|
class Meta:
|
|
|
|
|
|
|
|
model = Application
|
2018-12-26 16:17:39 +00:00
|
|
|
fields = ['name', 'slug', 'launch_url', 'icon_url',
|
2019-10-07 14:33:48 +00:00
|
|
|
'provider', 'policies', 'skip_authorization']
|
2018-11-26 21:09:04 +00:00
|
|
|
widgets = {
|
|
|
|
'name': forms.TextInput(),
|
|
|
|
'launch_url': forms.TextInput(),
|
|
|
|
'icon_url': forms.TextInput(),
|
2019-03-10 17:34:09 +00:00
|
|
|
'policies': FilteredSelectMultiple(_('policies'), False)
|
2018-11-26 21:09:04 +00:00
|
|
|
}
|
2019-02-21 15:06:57 +00:00
|
|
|
labels = {
|
|
|
|
'launch_url': _('Launch URL'),
|
|
|
|
'icon_url': _('Icon URL'),
|
|
|
|
}
|