--- a/app/soc/views/models/student.py Sat May 30 01:03:20 2009 +0200
+++ b/app/soc/views/models/student.py Sat May 30 09:19:10 2009 +0200
@@ -22,6 +22,8 @@
]
+import time
+
from django import forms
from django.utils.translation import ugettext
@@ -99,11 +101,17 @@
new_params['extra_dynaexclude'] = ['agreed_to_tos', 'school']
+ current_year = time.gmtime().tm_year
+ # the current year is not the minimum because a program could span
+ # more than one year
+ allowed_years = range(current_year-1, current_year+20)
+
new_params['create_extra_dynaproperties'] = {
- 'expected_graduation': forms.IntegerField(required=True,
- max_value=2030,
- min_value=2009)
- }
+ 'expected_graduation': forms.TypedChoiceField(
+ choices=[(x,x) for x in allowed_years],
+ coerce=lambda val: int(val)
+ )
+ }
new_params['create_dynafields'] = [
{'name': 'scope_path',