diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2013-04-18 18:53:42 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2013-04-18 18:53:42 +0200 |
commit | 92fcf8fcf23ac99aafd64a44e6cf8d4951dee796 (patch) | |
tree | c67cbcedc08259cec0b4cb3383772c2eafca1b6f /app | |
parent | b9b9200795b9fe7f6d054f117934e179a44f0224 (diff) | |
download | kosten-92fcf8fcf23ac99aafd64a44e6cf8d4951dee796.tar.gz kosten-92fcf8fcf23ac99aafd64a44e6cf8d4951dee796.tar.bz2 kosten-92fcf8fcf23ac99aafd64a44e6cf8d4951dee796.zip |
FIX: Make defaults in fields of forms a function.
Reason: Else default will be set on class creation -- which is bad if
you use 'today()' ...
Diffstat (limited to 'app')
-rw-r--r-- | app/forms.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/forms.py b/app/forms.py index 1ab3c72..8fbd4fb 100644 --- a/app/forms.py +++ b/app/forms.py @@ -28,7 +28,7 @@ req = [v.input_required()] class ExpenseForm(Form): date = DateField(u"Datum", req, format="%d.%m.%Y", - default=today()) + default=lambda: today()) expense = DecimalField(u"Betrag", req, description=u"EUR", @@ -42,11 +42,11 @@ class ExpenseForm(Form): class ConstForm(Form): start = DateField(u"Beginn", req, format="%m.%Y", - default=today()) + default=lambda: today()) end = DateField(u"Ende", req, format="%m.%Y", - default=today().replace(year = today().year + 1), + default=lambda: today().replace(year = today().year + 1), description=u"(einschließlich)") months = IntegerField(u"Zahlungsrythmus", req, |