Commit 0c20019c authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch 'cherry-pick-ccd627fe' into 'release/1.16'

Merge branch 'feature/registrations-starting-year-widget' into 'master'

See merge request !882
parents bb7568c8 9bf72ea9
"""The forms defined by the registrations package"""
from django import forms
from django.forms import TypedChoiceField
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from utils.snippets import datetime_to_lectureyear
from .models import Registration, Renewal
......@@ -20,6 +22,16 @@ class MemberRegistrationForm(forms.ModelForm):
label=_('I accept the privacy policy')
)
this_year = datetime_to_lectureyear(timezone.now())
years = reversed([(x, "{} - {}".format(x, x + 1)) for x in
range(this_year - 20, this_year + 1)])
starting_year = TypedChoiceField(
choices=years,
coerce=int,
empty_value=this_year
)
class Meta:
model = Registration
fields = '__all__'
......
Supports Markdown
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