SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit caf8770c authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Fix default values for timesheets

parent 2d332a0b
No related branches found
No related tags found
No related merge requests found
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment