Changeset 15807 for main/kofacustom.iuokada/trunk/src
- Timestamp:
- 14 Nov 2019, 14:45:16 (5 years ago)
- Location:
- main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/browser.py
r15793 r15807 19 19 """ 20 20 import grok 21 from zope.formlib.textwidgets import BytesDisplayWidget 21 22 from waeup.kofa.applicants.browser import ( 22 23 ApplicantRegistrationPage, ApplicantsContainerPage) 24 from waeup.kofa.applicants.interfaces import ISpecialApplicant 23 25 from kofacustom.nigeria.applicants.browser import ( 24 26 NigeriaApplicantDisplayFormPage, 27 NigeriaApplicantManageFormPage, 28 NigeriaApplicantEditFormPage, 25 29 NigeriaPDFApplicationSlip) 26 from kofacustom.iuokada.applicants.interfaces import ICustomApplicant 27 30 from kofacustom.nigeria.applicants.interfaces import ( 31 UG_OMIT_DISPLAY_FIELDS, 32 UG_OMIT_PDF_FIELDS, 33 UG_OMIT_MANAGE_FIELDS, 34 UG_OMIT_EDIT_FIELDS, 35 PG_OMIT_DISPLAY_FIELDS, 36 PG_OMIT_PDF_FIELDS, 37 PG_OMIT_MANAGE_FIELDS, 38 PG_OMIT_EDIT_FIELDS, 39 ) 40 from kofacustom.iuokada.applicants.interfaces import ( 41 ICustomPGApplicant, ICustomUGApplicant, 42 ICustomPGApplicantEdit, ICustomUGApplicantEdit, 43 ICustomApplicantOnlinePayment 44 ) 28 45 from kofacustom.iuokada.interfaces import MessageFactory as _ 29 46 … … 31 48 """A display view for applicant data. 32 49 """ 50 33 51 @property 34 52 def form_fields(self): 35 if self.context.special: 36 form_fields = grok.AutoFields(ISpecialApplicant).omit('locked') 53 if self.target is not None and self.target.startswith('pg'): 54 form_fields = grok.AutoFields(ICustomPGApplicant) 55 for field in PG_OMIT_DISPLAY_FIELDS: 56 form_fields = form_fields.omit(field) 37 57 else: 38 form_fields = grok.AutoFields(ICustomApplicant).omit( 39 'locked', 'course_admitted', 'password', 'suspended') 58 form_fields = grok.AutoFields(ICustomUGApplicant) 59 for field in UG_OMIT_DISPLAY_FIELDS: 60 form_fields = form_fields.omit(field) 61 #form_fields['perm_address'].custom_widget = BytesDisplayWidget 62 form_fields['notice'].custom_widget = BytesDisplayWidget 63 if not getattr(self.context, 'student_id'): 64 form_fields = form_fields.omit('student_id') 65 if not getattr(self.context, 'screening_score'): 66 form_fields = form_fields.omit('screening_score') 67 if not getattr(self.context, 'screening_venue') or self._not_paid(): 68 form_fields = form_fields.omit('screening_venue') 69 if not getattr(self.context, 'screening_date') or self._not_paid(): 70 form_fields = form_fields.omit('screening_date') 40 71 return form_fields 41 72 73 class CustomApplicantManageFormPage(NigeriaApplicantManageFormPage): 74 """A full edit view for applicant data. 75 """ 76 77 @property 78 def form_fields(self): 79 if self.target is not None and self.target.startswith('pg'): 80 form_fields = grok.AutoFields(ICustomPGApplicant) 81 for field in PG_OMIT_MANAGE_FIELDS: 82 form_fields = form_fields.omit(field) 83 else: 84 form_fields = grok.AutoFields(ICustomUGApplicant) 85 for field in UG_OMIT_MANAGE_FIELDS: 86 form_fields = form_fields.omit(field) 87 form_fields['student_id'].for_display = True 88 form_fields['applicant_id'].for_display = True 89 return form_fields 90 91 class CustomApplicantEditFormPage(NigeriaApplicantEditFormPage): 92 """An applicant-centered edit view for applicant data. 93 """ 94 95 @property 96 def form_fields(self): 97 if self.target is not None and self.target.startswith('pg'): 98 form_fields = grok.AutoFields(ICustomPGApplicantEdit) 99 for field in PG_OMIT_EDIT_FIELDS: 100 form_fields = form_fields.omit(field) 101 else: 102 form_fields = grok.AutoFields(ICustomUGApplicantEdit) 103 for field in UG_OMIT_EDIT_FIELDS: 104 form_fields = form_fields.omit(field) 105 form_fields['applicant_id'].for_display = True 106 form_fields['reg_number'].for_display = True 107 return form_fields 108 109 class CustomPDFApplicationSlip(NigeriaPDFApplicationSlip): 110 111 @property 112 def form_fields(self): 113 if self.target is not None and self.target.startswith('pg'): 114 form_fields = grok.AutoFields(ICustomPGApplicant) 115 for field in PG_OMIT_PDF_FIELDS: 116 form_fields = form_fields.omit(field) 117 else: 118 form_fields = grok.AutoFields(ICustomUGApplicant) 119 for field in UG_OMIT_PDF_FIELDS: 120 form_fields = form_fields.omit(field) 121 if not getattr(self.context, 'student_id'): 122 form_fields = form_fields.omit('student_id') 123 if not getattr(self.context, 'screening_score'): 124 form_fields = form_fields.omit('screening_score') 125 if not getattr(self.context, 'screening_venue'): 126 form_fields = form_fields.omit('screening_venue') 127 if not getattr(self.context, 'screening_date'): 128 form_fields = form_fields.omit('screening_date') 129 return form_fields 130 -
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/interfaces.py
r15793 r15807 28 28 from waeup.kofa.schema import FormattedDate, TextLineChoice 29 29 from waeup.kofa.students.vocabularies import nats_vocab, GenderSource 30 from waeup.kofa.applicants.interfaces import contextual_reg_num_source 30 from waeup.kofa.applicants.interfaces import ( 31 contextual_reg_num_source, IApplicantBaseData) 31 32 from kofacustom.nigeria.applicants.interfaces import ( 32 33 LGASource, high_qual, high_grade, exam_types, … … 79 80 required = False, 80 81 ) 82 83 ICustomUGApplicant[ 84 'sponsor'].order = ICustomUGApplicant['lga'].order 85 ICustomUGApplicant[ 86 'heard_about'].order = ICustomUGApplicant['lga'].order 87 ICustomUGApplicant[ 88 'sponsor'].order = ICustomUGApplicant['lga'].order 89 ICustomUGApplicant[ 90 'lga'].order = ICustomUGApplicant['nationality'].order 81 91 82 92 class ICustomPGApplicant(INigeriaPGApplicant):
Note: See TracChangeset for help on using the changeset viewer.