Verified Commit b5543223 authored by Jonathan Weth's avatar Jonathan Weth

Optimize forms.py

parent 8249be96
...@@ -8,11 +8,11 @@ from .models import Menu ...@@ -8,11 +8,11 @@ from .models import Menu
current_year = timezone.datetime.now().year current_year = timezone.datetime.now().year
options_for_year = [(current_year, current_year), (current_year + 1, current_year + 1)] options_for_year = [(current_year, current_year), (current_year + 1, current_year + 1)]
calendar_weeks = [(cw, cw) for cw in range(1, 53)] calendar_weeks = [(cw, str(cw)) for cw in range(1, 53)]
class MenuUploadForm(forms.ModelForm): class MenuUploadForm(forms.ModelForm):
calendar_week = forms.ChoiceField(choices=calendar_weeks) calendar_week = forms.ChoiceField(choices=calendar_weeks, initial=timezone.datetime.now().isocalendar()[1])
year = forms.ChoiceField( year = forms.ChoiceField(
initial=timezone.datetime.now().year, choices=options_for_year initial=timezone.datetime.now().year, choices=options_for_year
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment