Changeset 13877 for main/waeup.fceokene/trunk/src/waeup/fceokene/applicants
- Timestamp:
- 4 Jun 2016, 18:31:00 (9 years ago)
- Location:
- main/waeup.fceokene/trunk/src/waeup/fceokene/applicants
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/browser.py
r13238 r13877 46 46 BEC_OMIT_PDF_FIELDS, 47 47 BEC_OMIT_MANAGE_FIELDS, 48 BEC_OMIT_EDIT_FIELDS 48 BEC_OMIT_EDIT_FIELDS, 49 ITPURegistration 49 50 ) 50 51 … … 60 61 def form_fields(self): 61 62 target = getattr(self.context.__parent__, 'prefix', None) 63 if target == 'tpu': 64 form_fields = grok.AutoFields(ITPURegistration).omit( 65 'locked', 'suspended') 66 return form_fields 62 67 form_fields = grok.AutoFields(ICustomUGApplicant) 63 68 if target is not None and target.startswith('bec'): … … 107 112 def form_fields(self): 108 113 target = getattr(self.context.__parent__, 'prefix', None) 114 if target == 'tpu': 115 form_fields = grok.AutoFields(ITPURegistration).omit( 116 'locked', 'suspended') 117 return form_fields 109 118 form_fields = grok.AutoFields(ICustomUGApplicant) 110 119 if target is not None and target.startswith('bec'): … … 142 151 def form_fields(self): 143 152 target = getattr(self.context.__parent__, 'prefix', None) 153 if target == 'tpu': 154 form_fields = grok.AutoFields(ITPURegistration) 155 form_fields['applicant_id'].for_display = True 156 return form_fields 144 157 form_fields = grok.AutoFields(ICustomUGApplicant) 145 158 if target is not None and target.startswith('bec'): … … 160 173 def form_fields(self): 161 174 target = getattr(self.context.__parent__, 'prefix', None) 175 if target == 'tpu': 176 form_fields = grok.AutoFields(ITPURegistration).omit( 177 'locked', 'suspended') 178 form_fields['applicant_id'].for_display = True 179 form_fields['reg_number'].for_display = True 180 form_fields['firstname'].for_display = True 181 form_fields['middlename'].for_display = True 182 form_fields['lastname'].for_display = True 183 form_fields['lga'].for_display = True 184 form_fields['matric_number'].for_display = True 185 return form_fields 162 186 form_fields = grok.AutoFields(ICustomUGApplicantEdit) 163 187 if target is not None and target.startswith('bec'): -
main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/export.py
r13094 r13877 22 22 from kofacustom.nigeria.applicants.export import NigeriaApplicantExporter 23 23 from kofacustom.nigeria.applicants.interfaces import INigeriaUGApplicant 24 from waeup.fceokene.applicants.interfaces import ICustomUGApplicant 24 from waeup.fceokene.applicants.interfaces import ( 25 ICustomUGApplicant, ITPURegistration) 25 26 26 27 class CustomApplicantExporter(NigeriaApplicantExporter): … … 31 32 ICustomUGApplicant.names() + 32 33 INigeriaUGApplicant.names() + 33 IApplicantBaseData.names() 34 IApplicantBaseData.names() + 35 ITPURegistration.names() 34 36 ))) -
main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/interfaces.py
r13238 r13877 20 20 21 21 from zope import schema 22 from zc.sourcefactory.basic import BasicSourceFactory 22 23 from waeup.kofa.applicants.interfaces import ( 23 24 IApplicantBaseData, … … 25 26 from waeup.kofa.schoolgrades import ResultEntryField 26 27 from waeup.kofa.interfaces import ( 27 SimpleKofaVocabulary, academic_sessions_vocab, validate_email) 28 from waeup.kofa.schema import FormattedDate, TextLineChoice 28 SimpleKofaVocabulary, academic_sessions_vocab, validate_email, 29 IKofaObject) 30 from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber 29 31 from waeup.kofa.schoolgrades import ResultEntryField 30 32 from waeup.kofa.students.vocabularies import nats_vocab, GenderSource … … 39 41 OMIT_DISPLAY_FIELDS 40 42 ) 43 from waeup.fceokene.applicants.schools import SCHOOLS 41 44 from waeup.fceokene.interfaces import MessageFactory as _ 42 45 … … 53 56 'aggregate') 54 57 58 class SchoolSource(BasicSourceFactory): 59 """A source that delivers all kinds of registrations. 60 """ 61 def getValues(self): 62 sorted_items = sorted(SCHOOLS.items(), 63 key=lambda element: element[0]) 64 return [item[0] for item in sorted_items] 65 66 def getTitle(self, value): 67 return u"%s: %s -- %s" % ( 68 SCHOOLS[value][0], 69 SCHOOLS[value][1], 70 SCHOOLS[value][2],) 71 72 class ITPURegistration(IKofaObject): 73 """A TPU registrant. 74 """ 75 76 suspended = schema.Bool( 77 title = _(u'Account suspended'), 78 default = False, 79 required = False, 80 ) 81 82 locked = schema.Bool( 83 title = _(u'Form locked'), 84 default = False, 85 required = False, 86 ) 87 88 applicant_id = schema.TextLine( 89 title = _(u'Applicant Id'), 90 required = False, 91 readonly = False, 92 ) 93 94 reg_number = schema.TextLine( 95 title = _(u'Registration Number'), 96 required = False, 97 readonly = False, 98 ) 99 100 matric_number = schema.TextLine( 101 title = _(u'Matriculation Number'), 102 required = False, 103 readonly = False, 104 ) 105 106 firstname = schema.TextLine( 107 title = _(u'First Name'), 108 required = True, 109 ) 110 111 middlename = schema.TextLine( 112 title = _(u'Middle Name'), 113 required = False, 114 ) 115 116 lastname = schema.TextLine( 117 title = _(u'Last Name (Surname)'), 118 required = True, 119 ) 120 121 email = schema.ASCIILine( 122 title = _(u'Email Address'), 123 required = True, 124 constraint=validate_email, 125 ) 126 127 phone = PhoneNumber( 128 title = _(u'Phone'), 129 description = u'', 130 required = False, 131 ) 132 133 perm_address = schema.Text( 134 title = _(u'Home Address'), 135 required = False, 136 readonly = False, 137 ) 138 139 lga = schema.Choice( 140 source = LGASource(), 141 title = _(u'State/LGA'), 142 required = False, 143 ) 144 145 subj_comb = schema.TextLine( 146 title = _(u'Subject Combination'), 147 required = False, 148 readonly = False, 149 ) 150 151 school1 = schema.Choice( 152 title = _(u'1st Choice TPZ and School'), 153 source = SchoolSource(), 154 required = True, 155 ) 156 157 school2 = schema.Choice( 158 title = _(u'2nd Choice TPZ and School'), 159 source = SchoolSource(), 160 required = True, 161 ) 162 163 school3 = schema.Choice( 164 title = _(u'3rd Choice TPZ and School'), 165 source = SchoolSource(), 166 required = True, 167 ) 168 55 169 class ICustomUGApplicant(INigeriaUGApplicant): 56 170 """An undergraduate applicant. … … 237 351 """ 238 352 239 class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant): 240 """An interface for both types of applicants. 353 class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant, 354 ITPURegistration): 355 """An interface for all types of applicants. 241 356 242 357 Attention: The ICustomPGApplicant field seetings will be overwritten -
main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/utils.py
r13027 r13877 41 41 'pce': ['PCE Screening', 'PCE'], 42 42 'bec': ['Bachelor of Education Certificate Programmes', 'BEC'], 43 'rem': ['Remedial', 'REM'] 43 'rem': ['Remedial', 'REM'], 44 'tpu': ['Teaching Practice Unit', 'TPU'], 44 45 } 45 46
Note: See TracChangeset for help on using the changeset viewer.