From 92fcf8fcf23ac99aafd64a44e6cf8d4951dee796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Thu, 18 Apr 2013 18:53:42 +0200 Subject: 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()' ... --- app/forms.py | 6 +++--- 1 file 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, -- cgit v1.2.3