Changeset 17822 for main/waeup.uniben/trunk/src/waeup/uniben/students
- Timestamp:
- 27 Jun 2024, 07:47:23 (5 months ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/students
- Files:
-
- 4 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 -
main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py
r17395 r17822 23 23 from waeup.kofa.students.vocabularies import StudyLevelSource 24 24 from kofacustom.nigeria.interfaces import GradingSystemSource 25 from waeup.kofa.schema import FormattedDate 25 26 from kofacustom.nigeria.students.interfaces import ( 26 27 INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance, … … 215 216 ) 216 217 218 class INYSC(IKofaObject): 219 """Student NYSC data. 220 """ 221 222 nysc = schema.Bool( 223 title = u'NYSC', 224 default = False, 225 required = True, 226 ) 227 228 nysc_updated = schema.Datetime( 229 title = _(u'NYSC request data last updated by student'), 230 ) 231 232 nysc_date_of_graduation = FormattedDate( 233 title = _(u'Date of Graduation'), 234 required = False, 235 show_year = True, 236 ) 237 238 nysc_senate_info = schema.TextLine( 239 title = _(u'Senate Info'), 240 required = False, 241 ) 242 217 243 class ITiship(IKofaObject): 218 244 """Student tiship data. … … 239 265 ) 240 266 241 nysc = schema.Bool(242 title = _(u'Applying for NYSC'),243 default = False,244 required = True,245 )246 247 267 class ICustomStudentPersonalEdit(INigeriaStudentPersonalEdit): 248 268 """Interface for editing personal data by students. … … 255 275 ) 256 276 257 nysc = schema.Bool(258 title = _(u'Do you want to apply for NYSC?'),259 default = False,260 description = u'Ensure that all your school charges are paid up to date to your graduating session before making this nysc application.',261 required = True,262 )263 264 277 class ICustomUGStudentClearance(INigeriaUGStudentClearance): 265 278 """Representation of ug student clearance data. … … 272 285 class ICustomStudent(ICustomStudentBase, ICustomUGStudentClearance, 273 286 ICustomPGStudentClearance, ICustomStudentPersonal, IMedicalHistory, 274 ITiship ):287 ITiship, INYSC): 275 288 """Representation of a student. 276 289 """ -
main/waeup.uniben/trunk/src/waeup/uniben/students/student.py
r17395 r17822 29 29 from kofacustom.nigeria.students.student import NigeriaStudent 30 30 from waeup.uniben.students.interfaces import ( 31 ICustomStudent, ICustomStudentPersonalEdit, IMedicalHistory, ITiship) 31 ICustomStudent, ICustomStudentPersonalEdit, 32 IMedicalHistory, ITiship, INYSC) 32 33 33 34 … … 38 39 grok.implements( 39 40 ICustomStudent, IStudentNavigation, ICustomStudentPersonalEdit, 40 IMedicalHistory, ITiship )41 IMedicalHistory, ITiship, INYSC) 41 42 grok.provides(ICustomStudent) 42 43 … … 64 65 return self.state in (TRANSREL, TRANSVAL) 65 66 67 @property 68 def eligible_for_nysc(self): 69 if not self.current_mode.startswith('ug') \ 70 and not self.current_mode.startswith('de'): 71 return False 72 studycourse = self['studycourse'] 73 certificate = getattr(studycourse,'certificate',None) 74 current_level = studycourse.current_level 75 end_level = certificate.end_level 76 if not self.current_level >= end_level: 77 return False 78 return True 79 66 80 67 81 # Set all attributes of Student required in IStudent as field -
main/waeup.uniben/trunk/src/waeup/uniben/students/viewlets.py
r17812 r17822 237 237 return self.view.url(self.view.context, self.target) 238 238 239 class NYSCEditActionButton(ManageActionButton): 240 grok.order(13) 241 grok.context(ICustomStudent) 242 grok.view(StudentBaseDisplayFormPage) 243 grok.require('waeup.handleStudent') 244 text = _('NYSC Request') 245 target = 'edit_nysc' 246 icon = 'actionicon_nigeria.png' 247 248 @property 249 def target_url(self): 250 if not self.context.eligible_for_nysc: 251 return '' 252 return self.view.url(self.view.context, self.target) 253 254 class NYSCManageActionButton(ManageActionButton): 255 grok.require('waeup.manageStudent') 256 text = _('Manage NYSC request data') 257 target = 'manage_nysc' 258 grok.order(13) 259 grok.context(ICustomStudent) 260 grok.view(StudentBaseDisplayFormPage) 261 icon = 'actionicon_nigeria.png' 262 239 263 # JAMB Letter 240 264
Note: See TracChangeset for help on using the changeset viewer.