mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-25 09:11:13 +00:00
django2.2: forms fixs for new API
This commit is contained in:
parent
d7075eb762
commit
81fcf411c1
@ -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")),
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user