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
|
|
|
|
2020-05-10 00:14:55 +00:00
|
|
|
from passbook.policies.forms import GENERAL_FIELDS
|
2019-10-07 14:33:48 +00:00
|
|
|
from passbook.policies.hibp.models import HaveIBeenPwendPolicy
|
2019-02-25 16:21:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
class HaveIBeenPwnedPolicyForm(forms.ModelForm):
|
|
|
|
"""Edit HaveIBeenPwendPolicy instances"""
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
|
|
|
model = HaveIBeenPwendPolicy
|
2020-07-10 18:57:15 +00:00
|
|
|
fields = GENERAL_FIELDS + ["password_field", "allowed_count"]
|
2019-02-25 16:21:56 +00:00
|
|
|
widgets = {
|
2019-12-31 11:51:16 +00:00
|
|
|
"name": forms.TextInput(),
|
2020-07-10 18:57:15 +00:00
|
|
|
"password_field": forms.TextInput(),
|
2019-12-31 11:51:16 +00:00
|
|
|
"policies": FilteredSelectMultiple(_("policies"), False),
|
2019-02-25 16:21:56 +00:00
|
|
|
}
|