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):
|
||||
begin_date = forms.DateTimeField(
|
||||
["%Y-%m-%d %H:%M:%S"],
|
||||
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||
label=_("Begin date"),
|
||||
required=False,
|
||||
widget=SelectDateTime,
|
||||
)
|
||||
end_date = forms.DateTimeField(
|
||||
["%Y-%m-%d %H:%M:%S"],
|
||||
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||
label=_("End date"),
|
||||
required=False,
|
||||
widget=SelectDateTime,
|
||||
|
13
com/views.py
13
com/views.py
@ -74,14 +74,14 @@ class PosterForm(forms.ModelForm):
|
||||
widgets = {"screens": forms.CheckboxSelectMultiple}
|
||||
|
||||
date_begin = forms.DateTimeField(
|
||||
["%Y-%m-%d %H:%M:%S"],
|
||||
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||
label=_("Start date"),
|
||||
widget=SelectDateTime,
|
||||
required=True,
|
||||
initial=timezone.now().strftime("%Y-%m-%d %H:%M:%S"),
|
||||
)
|
||||
date_end = forms.DateTimeField(
|
||||
["%Y-%m-%d %H:%M:%S"],
|
||||
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||
label=_("End date"),
|
||||
widget=SelectDateTime,
|
||||
required=False,
|
||||
@ -200,19 +200,22 @@ class NewsForm(forms.ModelForm):
|
||||
}
|
||||
|
||||
start_date = forms.DateTimeField(
|
||||
["%Y-%m-%d %H:%M:%S"],
|
||||
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||
label=_("Start date"),
|
||||
widget=SelectDateTime,
|
||||
required=False,
|
||||
)
|
||||
end_date = forms.DateTimeField(
|
||||
["%Y-%m-%d %H:%M:%S"],
|
||||
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||
label=_("End date"),
|
||||
widget=SelectDateTime,
|
||||
required=False,
|
||||
)
|
||||
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)
|
||||
|
||||
|
@ -1554,13 +1554,13 @@ class CashSummaryEditView(CounterAdminTabsMixin, CounterAdminMixin, UpdateView):
|
||||
|
||||
class CashSummaryFormBase(forms.Form):
|
||||
begin_date = forms.DateTimeField(
|
||||
["%Y-%m-%d %H:%M:%S"],
|
||||
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||
label=_("Begin date"),
|
||||
required=False,
|
||||
widget=SelectDateTime,
|
||||
)
|
||||
end_date = forms.DateTimeField(
|
||||
["%Y-%m-%d %H:%M:%S"],
|
||||
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||
label=_("End date"),
|
||||
required=False,
|
||||
widget=SelectDateTime,
|
||||
|
@ -181,22 +181,25 @@ class ElectionForm(forms.ModelForm):
|
||||
)
|
||||
|
||||
start_date = forms.DateTimeField(
|
||||
["%Y-%m-%d %H:%M:%S"],
|
||||
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||
label=_("Start date"),
|
||||
widget=SelectDateTime,
|
||||
required=True,
|
||||
)
|
||||
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(
|
||||
["%Y-%m-%d %H:%M:%S"],
|
||||
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||
label=_("Start candidature"),
|
||||
widget=SelectDateTime,
|
||||
required=True,
|
||||
)
|
||||
end_candidature = forms.DateTimeField(
|
||||
["%Y-%m-%d %H:%M:%S"],
|
||||
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||
label=_("End candidature"),
|
||||
widget=SelectDateTime,
|
||||
required=True,
|
||||
|
@ -42,13 +42,13 @@ class SelectionDateForm(forms.Form):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(SelectionDateForm, self).__init__(*args, **kwargs)
|
||||
self.fields["start_date"] = forms.DateTimeField(
|
||||
["%Y-%m-%d %H:%M:%S"],
|
||||
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||
label=_("Start date"),
|
||||
widget=SelectDateTime,
|
||||
required=True,
|
||||
)
|
||||
self.fields["end_date"] = forms.DateTimeField(
|
||||
["%Y-%m-%d %H:%M:%S"],
|
||||
input_formats=["%Y-%m-%d %H:%M:%S"],
|
||||
label=_("End date"),
|
||||
widget=SelectDateTime,
|
||||
required=True,
|
||||
|
Loading…
Reference in New Issue
Block a user