app/soc/views/models/student.py
changeset 2927 ac4f93519855
parent 2922 6e373954bbf6
child 2929 04851beb824e
equal deleted inserted replaced
2926:effa1cfb3607 2927:ac4f93519855
    16 
    16 
    17 """Views for Student.
    17 """Views for Student.
    18 """
    18 """
    19 
    19 
    20 __authors__ = [
    20 __authors__ = [
       
    21     '"Madhusudan.C.S." <madhusudancs@gmail.com>',
    21     '"Lennard de Rijk" <ljvderijk@gmail.com>'
    22     '"Lennard de Rijk" <ljvderijk@gmail.com>'
    22   ]
    23   ]
    23 
    24 
    24 
    25 
    25 import time
    26 import time
    89 
    90 
    90     new_params['name'] = "Student"
    91     new_params['name'] = "Student"
    91     new_params['module_name'] = "student"
    92     new_params['module_name'] = "student"
    92     new_params['sidebar_grouping'] = 'Students'
    93     new_params['sidebar_grouping'] = 'Students'
    93 
    94 
       
    95     new_params['create_template'] = 'soc/student/edit.html'
       
    96     new_params['edit_template'] = 'soc/student/edit.html'
       
    97 
    94     # add apply pattern
    98     # add apply pattern
    95     patterns = [(r'^%(url_name)s/(?P<access_type>apply)/%(scope)s$',
    99     patterns = [(r'^%(url_name)s/(?P<access_type>apply)/%(scope)s$',
    96         '%(module_package)s.%(module_name)s.apply',
   100         '%(module_package)s.%(module_name)s.apply',
    97         'Become a %(name)s'),
   101         'Become a %(name)s'),
    98         (r'^%(url_name)s/(?P<access_type>list_projects)/%(scope)s$',
   102         (r'^%(url_name)s/(?P<access_type>list_projects)/%(scope)s$',
   110 
   114 
   111     new_params['create_extra_dynaproperties'] = {
   115     new_params['create_extra_dynaproperties'] = {
   112         'expected_graduation': forms.TypedChoiceField(
   116         'expected_graduation': forms.TypedChoiceField(
   113             choices=[(x,x) for x in allowed_years],
   117             choices=[(x,x) for x in allowed_years],
   114             coerce=lambda val: int(val)
   118             coerce=lambda val: int(val)
   115             )
   119             ),
   116         } 
   120         }
   117 
   121 
   118     new_params['create_dynafields'] = [
   122     new_params['create_dynafields'] = [
   119         {'name': 'scope_path',
   123         {'name': 'scope_path',
   120          'base': forms.fields.CharField,
   124          'base': forms.fields.CharField,
   121          'widget': forms.HiddenInput,
   125          'widget': forms.HiddenInput,
   145     # create and store the special form for users
   149     # create and store the special form for users
   146     updated_fields = {
   150     updated_fields = {
   147         'link_id': forms.CharField(widget=forms.HiddenInput,
   151         'link_id': forms.CharField(widget=forms.HiddenInput,
   148             required=True),
   152             required=True),
   149         'clean_link_id': cleaning.clean_user_is_current('link_id'),
   153         'clean_link_id': cleaning.clean_user_is_current('link_id'),
   150         'clean': cleaning.validate_student_age(
   154         'clean': cleaning.validate_student(
   151             'birth_date', 'scope_path', self._logic.getScopeLogic().logic),
   155             'birth_date', 'school_type', 'major', 'degree', 'grade', 
       
   156             'scope_path', self._logic.getScopeLogic().logic),
   152         }
   157         }
   153 
   158 
   154     user_create_form = dynaform.extendDynaForm(
   159     user_create_form = dynaform.extendDynaForm(
   155         dynaform = self._params['create_form'],
   160         dynaform = self._params['create_form'],
   156         dynaproperties = updated_fields)
   161         dynaproperties = updated_fields)