From caf8770c42d2948c05172d90c63550bce49be0a2 Mon Sep 17 00:00:00 2001 From: Jorran de Wit <jorrandewit@outlook.com> Date: Fri, 25 Jan 2019 08:32:58 +0100 Subject: [PATCH] Fix default values for timesheets --- finances/forms.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/finances/forms.py b/finances/forms.py index 75a320fd0..8e4ea1ef6 100644 --- a/finances/forms.py +++ b/finances/forms.py @@ -55,21 +55,15 @@ class LogsActiveFilter(forms.Form): employee = UserModelChoiceField( queryset=get_user_model().objects.filter(work_logs__isnull=False), required=False) month = forms.ChoiceField( - choices=[(None, 9 * '-')] + [(k, v) for k, v in MONTHS.items()], required=False) + choices=[(None, 9 * '-')] + [(k, v) for k, v in MONTHS.items()], required=False, initial=None) year = forms.ChoiceField(choices=[(y, y) for y in reversed(range(today.year-6, today.year+1))]) def __init__(self, *args, **kwargs): if not kwargs.get('data', False) and not args[0]: args = list(args) - args[0] = { - 'month': today.month, - 'year': today.year - } + args[0] = {'year': today.year} args = tuple(args) - kwargs['initial'] = { - 'month': today.month, - 'year': today.year - } + kwargs['initial'] = {'year': today.year} super().__init__(*args, **kwargs) def filter(self): -- GitLab