mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-24 10:04:34 +00:00
django2.2: adapt DateTimeField in forms with the new API
This commit is contained in:
parent
6cc234e8d3
commit
12b6f0d488
@ -159,13 +159,13 @@ class MailingForm(forms.Form):
|
|||||||
|
|
||||||
class SellingsFormBase(forms.Form):
|
class SellingsFormBase(forms.Form):
|
||||||
begin_date = forms.DateTimeField(
|
begin_date = forms.DateTimeField(
|
||||||
["%Y-%m-%d %H:%M:%S"],
|
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||||
label=_("Begin date"),
|
label=_("Begin date"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=SelectDateTime,
|
widget=SelectDateTime,
|
||||||
)
|
)
|
||||||
end_date = forms.DateTimeField(
|
end_date = forms.DateTimeField(
|
||||||
["%Y-%m-%d %H:%M:%S"],
|
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||||
label=_("End date"),
|
label=_("End date"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=SelectDateTime,
|
widget=SelectDateTime,
|
||||||
|
13
com/views.py
13
com/views.py
@ -74,14 +74,14 @@ class PosterForm(forms.ModelForm):
|
|||||||
widgets = {"screens": forms.CheckboxSelectMultiple}
|
widgets = {"screens": forms.CheckboxSelectMultiple}
|
||||||
|
|
||||||
date_begin = forms.DateTimeField(
|
date_begin = forms.DateTimeField(
|
||||||
["%Y-%m-%d %H:%M:%S"],
|
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||||
label=_("Start date"),
|
label=_("Start date"),
|
||||||
widget=SelectDateTime,
|
widget=SelectDateTime,
|
||||||
required=True,
|
required=True,
|
||||||
initial=timezone.now().strftime("%Y-%m-%d %H:%M:%S"),
|
initial=timezone.now().strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
)
|
)
|
||||||
date_end = forms.DateTimeField(
|
date_end = forms.DateTimeField(
|
||||||
["%Y-%m-%d %H:%M:%S"],
|
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||||
label=_("End date"),
|
label=_("End date"),
|
||||||
widget=SelectDateTime,
|
widget=SelectDateTime,
|
||||||
required=False,
|
required=False,
|
||||||
@ -200,19 +200,22 @@ class NewsForm(forms.ModelForm):
|
|||||||
}
|
}
|
||||||
|
|
||||||
start_date = forms.DateTimeField(
|
start_date = forms.DateTimeField(
|
||||||
["%Y-%m-%d %H:%M:%S"],
|
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||||
label=_("Start date"),
|
label=_("Start date"),
|
||||||
widget=SelectDateTime,
|
widget=SelectDateTime,
|
||||||
required=False,
|
required=False,
|
||||||
)
|
)
|
||||||
end_date = forms.DateTimeField(
|
end_date = forms.DateTimeField(
|
||||||
["%Y-%m-%d %H:%M:%S"],
|
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||||
label=_("End date"),
|
label=_("End date"),
|
||||||
widget=SelectDateTime,
|
widget=SelectDateTime,
|
||||||
required=False,
|
required=False,
|
||||||
)
|
)
|
||||||
until = forms.DateTimeField(
|
until = forms.DateTimeField(
|
||||||
["%Y-%m-%d %H:%M:%S"], label=_("Until"), widget=SelectDateTime, required=False
|
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||||
|
label=_("Until"),
|
||||||
|
widget=SelectDateTime,
|
||||||
|
required=False,
|
||||||
)
|
)
|
||||||
automoderation = forms.BooleanField(label=_("Automoderation"), required=False)
|
automoderation = forms.BooleanField(label=_("Automoderation"), required=False)
|
||||||
|
|
||||||
|
@ -1554,13 +1554,13 @@ class CashSummaryEditView(CounterAdminTabsMixin, CounterAdminMixin, UpdateView):
|
|||||||
|
|
||||||
class CashSummaryFormBase(forms.Form):
|
class CashSummaryFormBase(forms.Form):
|
||||||
begin_date = forms.DateTimeField(
|
begin_date = forms.DateTimeField(
|
||||||
["%Y-%m-%d %H:%M:%S"],
|
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||||
label=_("Begin date"),
|
label=_("Begin date"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=SelectDateTime,
|
widget=SelectDateTime,
|
||||||
)
|
)
|
||||||
end_date = forms.DateTimeField(
|
end_date = forms.DateTimeField(
|
||||||
["%Y-%m-%d %H:%M:%S"],
|
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||||
label=_("End date"),
|
label=_("End date"),
|
||||||
required=False,
|
required=False,
|
||||||
widget=SelectDateTime,
|
widget=SelectDateTime,
|
||||||
|
@ -181,22 +181,25 @@ class ElectionForm(forms.ModelForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
start_date = forms.DateTimeField(
|
start_date = forms.DateTimeField(
|
||||||
["%Y-%m-%d %H:%M:%S"],
|
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||||
label=_("Start date"),
|
label=_("Start date"),
|
||||||
widget=SelectDateTime,
|
widget=SelectDateTime,
|
||||||
required=True,
|
required=True,
|
||||||
)
|
)
|
||||||
end_date = forms.DateTimeField(
|
end_date = forms.DateTimeField(
|
||||||
["%Y-%m-%d %H:%M:%S"], label=_("End date"), widget=SelectDateTime, required=True
|
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||||
|
label=_("End date"),
|
||||||
|
widget=SelectDateTime,
|
||||||
|
required=True,
|
||||||
)
|
)
|
||||||
start_candidature = forms.DateTimeField(
|
start_candidature = forms.DateTimeField(
|
||||||
["%Y-%m-%d %H:%M:%S"],
|
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||||
label=_("Start candidature"),
|
label=_("Start candidature"),
|
||||||
widget=SelectDateTime,
|
widget=SelectDateTime,
|
||||||
required=True,
|
required=True,
|
||||||
)
|
)
|
||||||
end_candidature = forms.DateTimeField(
|
end_candidature = forms.DateTimeField(
|
||||||
["%Y-%m-%d %H:%M:%S"],
|
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||||
label=_("End candidature"),
|
label=_("End candidature"),
|
||||||
widget=SelectDateTime,
|
widget=SelectDateTime,
|
||||||
required=True,
|
required=True,
|
||||||
|
@ -42,13 +42,13 @@ class SelectionDateForm(forms.Form):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(SelectionDateForm, self).__init__(*args, **kwargs)
|
super(SelectionDateForm, self).__init__(*args, **kwargs)
|
||||||
self.fields["start_date"] = forms.DateTimeField(
|
self.fields["start_date"] = forms.DateTimeField(
|
||||||
["%Y-%m-%d %H:%M:%S"],
|
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||||
label=_("Start date"),
|
label=_("Start date"),
|
||||||
widget=SelectDateTime,
|
widget=SelectDateTime,
|
||||||
required=True,
|
required=True,
|
||||||
)
|
)
|
||||||
self.fields["end_date"] = forms.DateTimeField(
|
self.fields["end_date"] = forms.DateTimeField(
|
||||||
["%Y-%m-%d %H:%M:%S"],
|
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||||
label=_("End date"),
|
label=_("End date"),
|
||||||
widget=SelectDateTime,
|
widget=SelectDateTime,
|
||||||
required=True,
|
required=True,
|
||||||
|
Loading…
Reference in New Issue
Block a user