summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-08-22 16:27:22 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-08-22 16:27:22 +0200
commit34607c105cca3cc9c19c531e06b73420ed1a0ad7 (patch)
tree6214284c13d5ed89df0f931008e0f30db49bbc90 /ishtar_common
parentd80ffeef9f1a04a33e13dc54829cb4b7b1cee433 (diff)
downloadIshtar-34607c105cca3cc9c19c531e06b73420ed1a0ad7.tar.bz2
Ishtar-34607c105cca3cc9c19c531e06b73420ed1a0ad7.zip
Closing date: force today at the initialisation of the form (refs #2212)
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/forms.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py
index bf19dbc49..89df1b1a5 100644
--- a/ishtar_common/forms.py
+++ b/ishtar_common/forms.py
@@ -122,8 +122,14 @@ def get_now():
class ClosingDateFormSelection(forms.Form):
form_label = _("Closing date")
end_date = forms.DateField(label=_(u"Closing date"),
- widget=widgets.JQueryDate,
- initial=datetime.date.today)
+ widget=widgets.JQueryDate)
+
+ def __init__(self, *args, **kwargs):
+ if 'initial' not in kwargs:
+ kwargs['initial'] = {}
+ if not kwargs['initial'].get('end_date', None):
+ kwargs['initial']['end_date'] = datetime.date.today()
+ super(ClosingDateFormSelection, self).__init__(*args, **kwargs)
def get_form_selection(