django2.2: forms fixs for new API

This commit is contained in:
Antoine Bartuccio 2019-10-06 16:50:55 +02:00
parent d7075eb762
commit 81fcf411c1
Signed by: klmp200
GPG Key ID: E7245548C53F904B
2 changed files with 3 additions and 16 deletions

View File

@ -66,7 +66,7 @@ class MailingForm(forms.Form):
super(MailingForm, self).__init__(*args, **kwargs)
self.fields["action"] = forms.TypedChoiceField(
(
choices=(
(self.ACTION_NEW_MAILING, _("New Mailing")),
(self.ACTION_NEW_SUBSCRIPTION, _("Subscribe")),
(self.ACTION_REMOVE_SUBSCRIPTION, _("Remove")),

View File

@ -28,23 +28,10 @@ class LimitedCheckboxField(forms.ModelMultipleChoiceField):
automatic backend verification
"""
def __init__(
self,
queryset,
max_choice,
required=True,
widget=None,
label=None,
initial=None,
help_text="",
*args,
**kwargs
):
def __init__(self, queryset, max_choice, **kwargs):
self.max_choice = max_choice
widget = forms.CheckboxSelectMultiple()
super(LimitedCheckboxField, self).__init__(
queryset, None, required, widget, label, initial, help_text, *args, **kwargs
)
super(LimitedCheckboxField, self).__init__(queryset, **kwargs)
def clean(self, value):
qs = super(LimitedCheckboxField, self).clean(value)