2019-02-25 16:21:56 +00:00
|
|
|
"""passbook HaveIBeenPwned Policy forms"""
|
|
|
|
|
|
|
|
from django import forms
|
2019-03-10 17:34:09 +00:00
|
|
|
from django.contrib.admin.widgets import FilteredSelectMultiple
|
|
|
|
from django.utils.translation import gettext as _
|
2019-02-25 16:21:56 +00:00
|
|
|
|
|
|
|
from passbook.core.forms.policies import GENERAL_FIELDS
|
|
|
|
from passbook.hibp_policy.models import HaveIBeenPwendPolicy
|
|
|
|
|
|
|
|
|
|
|
|
class HaveIBeenPwnedPolicyForm(forms.ModelForm):
|
|
|
|
"""Edit HaveIBeenPwendPolicy instances"""
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
|
|
|
model = HaveIBeenPwendPolicy
|
|
|
|
fields = GENERAL_FIELDS + ['allowed_count']
|
|
|
|
widgets = {
|
|
|
|
'name': forms.TextInput(),
|
|
|
|
'order': forms.NumberInput(),
|
2019-03-10 17:34:09 +00:00
|
|
|
'policies': FilteredSelectMultiple(_('policies'), False)
|
2019-02-25 16:21:56 +00:00
|
|
|
}
|