Commit ccd627fe authored by Thom Wiggers's avatar Thom Wiggers 📐

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

Make starting year a dropdown in registration form

Closes #667

See merge request !869
parents 972f3778 bd405422
"""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__'
......
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