705 |
705 |
706 if not birth_date or not program_key_name: |
706 if not birth_date or not program_key_name: |
707 # nothing to check, field validator will find these errors |
707 # nothing to check, field validator will find these errors |
708 return cleaned_data |
708 return cleaned_data |
709 |
709 |
710 # get the current program entity or bail out 404 |
710 # get the current program entity |
711 entity = program_logic.getFromKeyName(program_key_name) |
711 entity = program_logic.getFromKeyName(program_key_name) |
712 |
712 |
713 if not entity: |
713 if not entity: |
714 raise forms.ValidationError( |
714 raise forms.ValidationError( |
715 ugettext("No valid program found")) |
715 ugettext("No valid program found")) |
716 |
716 |
717 school_type = cleaned_data.get(school_type_field) |
717 school_type = cleaned_data.get(school_type_field) |
718 major = cleaned_data.get(major_field) |
718 major = cleaned_data.get(major_field) |
719 degree = cleaned_data.get(degree_field) |
719 degree = cleaned_data.get(degree_field) |
|
720 |
|
721 # TODO: when school_type is required this can be removed |
|
722 if not school_type: |
|
723 raise forms.ValidationError("School type cannot be left blank.") |
720 |
724 |
721 # if school_type is University, check for major |
725 # if school_type is University, check for major |
722 if school_type == 'University' and not major: |
726 if school_type == 'University' and not major: |
723 raise forms.ValidationError("Major cannot be left blank.") |
727 raise forms.ValidationError("Major cannot be left blank.") |
724 |
728 |