- Timestamp:
- 27 Jun 2024, 07:47:23 (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py
r17812 r17822 77 77 IMedicalHistory, 78 78 ITiship, 79 INYSC, 79 80 ICustomCourseTicket) 80 81 from waeup.uniben.interfaces import MessageFactory as _ … … 552 553 form_fields = grok.AutoFields( 553 554 ICustomStudentPersonalEdit).omit('personal_updated') + grok.AutoFields(ITiship) 554 studycourse = self.context['studycourse']555 certificate = getattr(studycourse,'certificate',None)556 current_level = studycourse.current_level557 end_level = certificate.end_level558 if not self.context.current_level >= end_level:559 form_fields = form_fields.omit('nysc')560 555 return form_fields 561 556 … … 1072 1067 self.context.student, omit_fields=self.omit_fields, 1073 1068 letterhead_path=letterhead_path, post_text=None) 1069 1070 class StudentNYSCEditFormPage(KofaEditFormPage): 1071 """ Page to edit NYSC data 1072 """ 1073 grok.context(ICustomStudent) 1074 grok.name('edit_nysc') 1075 grok.require('waeup.handleStudent') 1076 label = _('NYSC Request') 1077 pnav = 4 1078 1079 def update(self): 1080 if not self.context.eligible_for_nysc: 1081 self.flash('You are not allowed to apply for NYSC.', 1082 type="warning") 1083 self.redirect(self.url(self.context)) 1084 return 1085 return super(StudentNYSCEditFormPage, self).update() 1086 1087 @property 1088 def form_fields(self): 1089 form_fields = grok.AutoFields(INYSC) 1090 form_fields['nysc_updated'].for_display = True 1091 form_fields['nysc_senate_info'].for_display = True 1092 form_fields['nysc'].field.description = u'Ensure that all your school charges are paid up to date to your graduating session before making this nysc application.' 1093 form_fields['nysc'].field.title = u'Do you want to apply for NYSC?' 1094 form_fields[ 1095 'nysc_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le') 1096 form_fields['nysc'].custom_widget = CustomBooleanRadioWidget 1097 return form_fields 1098 1099 @action(_('Save'), style='primary') 1100 def save(self, **data): 1101 msave(self, **data) 1102 self.context.nysc_updated = datetime.utcnow() 1103 return 1104 1105 class StudentNYSCManageFormPage(KofaEditFormPage): 1106 """ Page to manage NYSC data 1107 """ 1108 grok.context(ICustomStudent) 1109 grok.name('manage_nysc') 1110 grok.require('waeup.manageStudent') 1111 label = _('Manage NYSC request data') 1112 1113 @property 1114 def form_fields(self): 1115 form_fields = grok.AutoFields(INYSC) 1116 form_fields['nysc_updated'].for_display = True 1117 form_fields['nysc'].field.description = u'' 1118 form_fields['nysc'].field.title = u'NYSC requested' 1119 form_fields[ 1120 'nysc_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le') 1121 return form_fields 1122 1123 @action(_('Save'), style='primary') 1124 def save(self, **data): 1125 msave(self, **data) 1126 return
Note: See TracChangeset for help on using the changeset viewer.