1 | ## $Id: interfaces.py 13140 2015-07-05 15:10:20Z henrik $ |
---|
2 | ## |
---|
3 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
4 | ## This program is free software; you can redistribute it and/or modify |
---|
5 | ## it under the terms of the GNU General Public License as published by |
---|
6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
7 | ## (at your option) any later version. |
---|
8 | ## |
---|
9 | ## This program is distributed in the hope that it will be useful, |
---|
10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | ## GNU General Public License for more details. |
---|
13 | ## |
---|
14 | ## You should have received a copy of the GNU General Public License |
---|
15 | ## along with this program; if not, write to the Free Software |
---|
16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
17 | ## |
---|
18 | """Customized interfaces of the university application package. |
---|
19 | """ |
---|
20 | |
---|
21 | from zope import schema |
---|
22 | from waeup.kofa.applicants.interfaces import ( |
---|
23 | contextual_reg_num_source, |
---|
24 | IApplicantBaseData, |
---|
25 | AppCatCertificateSource, CertificateSource) |
---|
26 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
27 | from waeup.kofa.interfaces import ( |
---|
28 | SimpleKofaVocabulary, academic_sessions_vocab, validate_email) |
---|
29 | from waeup.kofa.schema import FormattedDate, TextLineChoice |
---|
30 | from waeup.kofa.students.vocabularies import nats_vocab, GenderSource |
---|
31 | from kofacustom.nigeria.interfaces import ( |
---|
32 | LGASource, high_qual, high_grade, exam_types) |
---|
33 | from kofacustom.nigeria.interfaces import MessageFactory as _ |
---|
34 | from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment |
---|
35 | |
---|
36 | # Fields to be omitted in all display forms. course_admitted is |
---|
37 | # rendered separately. |
---|
38 | |
---|
39 | OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted', |
---|
40 | 'result_uploaded', 'suspended', 'special_application') |
---|
41 | |
---|
42 | # UG students are all undergraduate students. |
---|
43 | UG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS |
---|
44 | UG_OMIT_PDF_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
45 | UG_OMIT_MANAGE_FIELDS = ('special_application',) |
---|
46 | UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + ( |
---|
47 | 'student_id', 'notice', |
---|
48 | 'screening_score', 'screening_venue', |
---|
49 | 'screening_date', 'jamb_age', 'jamb_subjects', |
---|
50 | 'jamb_score', 'aggregate') |
---|
51 | |
---|
52 | # PUTME is a subgroup of UG with the same interface. |
---|
53 | PUTME_OMIT_FIELDS = ( |
---|
54 | 'hq_type', 'hq_matric_no', |
---|
55 | 'hq_degree', 'hq_school', |
---|
56 | 'hq_session', 'hq_disc',) |
---|
57 | PUTME_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUTME_OMIT_FIELDS |
---|
58 | PUTME_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUTME_OMIT_FIELDS |
---|
59 | PUTME_OMIT_EDIT_FIELDS = UG_OMIT_EDIT_FIELDS + PUTME_OMIT_FIELDS + ( |
---|
60 | 'firstname', 'middlename', 'lastname', 'sex', |
---|
61 | 'course1', 'lga') |
---|
62 | PUTME_OMIT_PDF_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
63 | PUTME_OMIT_RESULT_SLIP_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + ( |
---|
64 | 'phone', |
---|
65 | 'date_of_birth', 'sex', |
---|
66 | 'nationality', 'lga', #'perm_address', |
---|
67 | 'course2', 'screening_venue', |
---|
68 | 'screening_date') |
---|
69 | |
---|
70 | # PUDE is a subgroup of UG with the same interface. |
---|
71 | PUDE_OMIT_FIELDS = ( |
---|
72 | 'jamb_subjects','jamb_score', 'jamb_age', 'aggregate') |
---|
73 | PUDE_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUDE_OMIT_FIELDS |
---|
74 | PUDE_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUDE_OMIT_FIELDS |
---|
75 | PUDE_OMIT_EDIT_FIELDS = set(UG_OMIT_EDIT_FIELDS + PUDE_OMIT_FIELDS + ( |
---|
76 | 'firstname', 'middlename', 'lastname', 'sex', |
---|
77 | 'course1', 'lga')) |
---|
78 | PUDE_OMIT_PDF_FIELDS = PUDE_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
79 | PUDE_OMIT_RESULT_SLIP_FIELDS = PUDE_OMIT_DISPLAY_FIELDS + ( |
---|
80 | 'phone', |
---|
81 | 'date_of_birth', 'sex', |
---|
82 | 'nationality', 'lga', #'perm_address', |
---|
83 | 'course2', 'screening_venue', |
---|
84 | 'screening_date') |
---|
85 | |
---|
86 | # PG has its own interface |
---|
87 | PG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS |
---|
88 | PG_OMIT_PDF_FIELDS = PG_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
89 | PG_OMIT_MANAGE_FIELDS = ('special_application',) |
---|
90 | PG_OMIT_EDIT_FIELDS = PG_OMIT_MANAGE_FIELDS + PG_OMIT_DISPLAY_FIELDS + ( |
---|
91 | 'student_id', 'notice', |
---|
92 | 'screening_score', 'screening_venue', |
---|
93 | 'screening_date',) |
---|
94 | |
---|
95 | class INigeriaUGApplicant(IApplicantBaseData): |
---|
96 | """An undergraduate applicant. |
---|
97 | |
---|
98 | This interface defines the least common multiple of all fields |
---|
99 | in ug application forms. In customized forms, fields can be excluded by |
---|
100 | adding them to the UG_OMIT* tuples. |
---|
101 | """ |
---|
102 | |
---|
103 | nationality = schema.Choice( |
---|
104 | source = nats_vocab, |
---|
105 | title = _(u'Nationality'), |
---|
106 | required = False, |
---|
107 | ) |
---|
108 | lga = schema.Choice( |
---|
109 | source = LGASource(), |
---|
110 | title = _(u'State/LGA (Nigerians only)'), |
---|
111 | required = False, |
---|
112 | ) |
---|
113 | #perm_address = schema.Text( |
---|
114 | # title = _(u'Permanent Address'), |
---|
115 | # required = False, |
---|
116 | # ) |
---|
117 | course1 = schema.Choice( |
---|
118 | title = _(u'1st Choice Course of Study'), |
---|
119 | source = AppCatCertificateSource(), |
---|
120 | required = True, |
---|
121 | ) |
---|
122 | course2 = schema.Choice( |
---|
123 | title = _(u'2nd Choice Course of Study'), |
---|
124 | source = AppCatCertificateSource(), |
---|
125 | required = False, |
---|
126 | ) |
---|
127 | hq_type = schema.Choice( |
---|
128 | title = _(u'Qualification Obtained'), |
---|
129 | required = False, |
---|
130 | readonly = False, |
---|
131 | vocabulary = high_qual, |
---|
132 | ) |
---|
133 | hq_matric_no = schema.TextLine( |
---|
134 | title = _(u'Former Matric Number'), |
---|
135 | required = False, |
---|
136 | readonly = False, |
---|
137 | ) |
---|
138 | hq_degree = schema.Choice( |
---|
139 | title = _(u'Class of Degree'), |
---|
140 | required = False, |
---|
141 | readonly = False, |
---|
142 | vocabulary = high_grade, |
---|
143 | ) |
---|
144 | hq_school = schema.TextLine( |
---|
145 | title = _(u'Institution Attended'), |
---|
146 | required = False, |
---|
147 | readonly = False, |
---|
148 | ) |
---|
149 | hq_session = schema.TextLine( |
---|
150 | title = _(u'Years Attended'), |
---|
151 | required = False, |
---|
152 | readonly = False, |
---|
153 | ) |
---|
154 | hq_disc = schema.TextLine( |
---|
155 | title = _(u'Discipline'), |
---|
156 | required = False, |
---|
157 | readonly = False, |
---|
158 | ) |
---|
159 | jamb_subjects = schema.Text( |
---|
160 | title = _(u'Subjects and Scores'), |
---|
161 | required = False, |
---|
162 | ) |
---|
163 | jamb_score = schema.Int( |
---|
164 | title = _(u'Total JAMB Score'), |
---|
165 | required = False, |
---|
166 | ) |
---|
167 | jamb_age = schema.Int( |
---|
168 | title = _(u'Age (provided by JAMB)'), |
---|
169 | required = False, |
---|
170 | ) |
---|
171 | notice = schema.Text( |
---|
172 | title = _(u'Notice'), |
---|
173 | required = False, |
---|
174 | ) |
---|
175 | screening_venue = schema.TextLine( |
---|
176 | title = _(u'Screening Venue'), |
---|
177 | required = False, |
---|
178 | ) |
---|
179 | screening_date = schema.TextLine( |
---|
180 | title = _(u'Screening Date'), |
---|
181 | required = False, |
---|
182 | ) |
---|
183 | screening_score = schema.Int( |
---|
184 | title = _(u'Screening Score (%)'), |
---|
185 | required = False, |
---|
186 | ) |
---|
187 | aggregate = schema.Int( |
---|
188 | title = _(u'Aggregate Score (%)'), |
---|
189 | description = _(u'(average of relative JAMB and PUTME scores)'), |
---|
190 | required = False, |
---|
191 | ) |
---|
192 | result_uploaded = schema.Bool( |
---|
193 | title = _(u'Result uploaded'), |
---|
194 | default = False, |
---|
195 | required = False, |
---|
196 | ) |
---|
197 | student_id = schema.TextLine( |
---|
198 | title = _(u'Student Id'), |
---|
199 | required = False, |
---|
200 | readonly = False, |
---|
201 | ) |
---|
202 | course_admitted = schema.Choice( |
---|
203 | title = _(u'Admitted Course of Study'), |
---|
204 | source = CertificateSource(), |
---|
205 | required = False, |
---|
206 | ) |
---|
207 | locked = schema.Bool( |
---|
208 | title = _(u'Form locked'), |
---|
209 | default = False, |
---|
210 | required = False, |
---|
211 | ) |
---|
212 | |
---|
213 | INigeriaUGApplicant[ |
---|
214 | 'locked'].order = IApplicantBaseData['suspended'].order |
---|
215 | INigeriaUGApplicant[ |
---|
216 | 'result_uploaded'].order = INigeriaUGApplicant['suspended'].order |
---|
217 | |
---|
218 | class INigeriaPGApplicant(IApplicantBaseData): |
---|
219 | """A postgraduate applicant. |
---|
220 | |
---|
221 | This interface defines the least common multiple of all fields |
---|
222 | in pg application forms. In customized forms, fields can be excluded by |
---|
223 | adding them to the PG_OMIT* tuples. |
---|
224 | """ |
---|
225 | |
---|
226 | nationality = schema.Choice( |
---|
227 | source = nats_vocab, |
---|
228 | title = _(u'Nationality'), |
---|
229 | required = True, |
---|
230 | ) |
---|
231 | lga = schema.Choice( |
---|
232 | source = LGASource(), |
---|
233 | title = _(u'State/LGA (Nigerians only)'), |
---|
234 | required = False, |
---|
235 | ) |
---|
236 | #perm_address = schema.Text( |
---|
237 | # title = _(u'Permanent Address'), |
---|
238 | # required = False, |
---|
239 | # ) |
---|
240 | course1 = schema.Choice( |
---|
241 | title = _(u'1st Choice Course of Study'), |
---|
242 | source = AppCatCertificateSource(), |
---|
243 | required = True, |
---|
244 | ) |
---|
245 | course2 = schema.Choice( |
---|
246 | title = _(u'2nd Choice Course of Study'), |
---|
247 | source = AppCatCertificateSource(), |
---|
248 | required = False, |
---|
249 | ) |
---|
250 | hq_type = schema.Choice( |
---|
251 | title = _(u'Qualification Obtained'), |
---|
252 | required = False, |
---|
253 | readonly = False, |
---|
254 | vocabulary = high_qual, |
---|
255 | ) |
---|
256 | hq_matric_no = schema.TextLine( |
---|
257 | title = _(u'Former Matric Number'), |
---|
258 | required = False, |
---|
259 | readonly = False, |
---|
260 | ) |
---|
261 | hq_degree = schema.Choice( |
---|
262 | title = _(u'Class of Degree'), |
---|
263 | required = False, |
---|
264 | readonly = False, |
---|
265 | vocabulary = high_grade, |
---|
266 | ) |
---|
267 | hq_school = schema.TextLine( |
---|
268 | title = _(u'Institution Attended'), |
---|
269 | required = False, |
---|
270 | readonly = False, |
---|
271 | ) |
---|
272 | hq_session = schema.TextLine( |
---|
273 | title = _(u'Years Attended'), |
---|
274 | required = False, |
---|
275 | readonly = False, |
---|
276 | ) |
---|
277 | hq_disc = schema.TextLine( |
---|
278 | title = _(u'Discipline'), |
---|
279 | required = False, |
---|
280 | readonly = False, |
---|
281 | ) |
---|
282 | fst_sit_fname = schema.TextLine( |
---|
283 | title = _(u'Full Name'), |
---|
284 | required = False, |
---|
285 | readonly = False, |
---|
286 | ) |
---|
287 | fst_sit_no = schema.TextLine( |
---|
288 | title = _(u'Exam Number'), |
---|
289 | required = False, |
---|
290 | readonly = False, |
---|
291 | ) |
---|
292 | fst_sit_date = FormattedDate( |
---|
293 | title = _(u'Exam Date'), |
---|
294 | required = False, |
---|
295 | readonly = False, |
---|
296 | show_year = True, |
---|
297 | ) |
---|
298 | fst_sit_type = schema.Choice( |
---|
299 | title = _(u'Exam Type'), |
---|
300 | required = False, |
---|
301 | readonly = False, |
---|
302 | vocabulary = exam_types, |
---|
303 | ) |
---|
304 | fst_sit_results = schema.List( |
---|
305 | title = _(u'Exam Results'), |
---|
306 | value_type = ResultEntryField(), |
---|
307 | required = False, |
---|
308 | readonly = False, |
---|
309 | default = [], |
---|
310 | ) |
---|
311 | scd_sit_fname = schema.TextLine( |
---|
312 | title = _(u'Full Name'), |
---|
313 | required = False, |
---|
314 | readonly = False, |
---|
315 | ) |
---|
316 | scd_sit_no = schema.TextLine( |
---|
317 | title = _(u'Exam Number'), |
---|
318 | required = False, |
---|
319 | readonly = False, |
---|
320 | ) |
---|
321 | scd_sit_date = FormattedDate( |
---|
322 | title = _(u'Exam Date'), |
---|
323 | required = False, |
---|
324 | readonly = False, |
---|
325 | show_year = True, |
---|
326 | ) |
---|
327 | scd_sit_type = schema.Choice( |
---|
328 | title = _(u'Exam Type'), |
---|
329 | required = False, |
---|
330 | readonly = False, |
---|
331 | vocabulary = exam_types, |
---|
332 | ) |
---|
333 | scd_sit_results = schema.List( |
---|
334 | title = _(u'Exam Results'), |
---|
335 | value_type = ResultEntryField(), |
---|
336 | required = False, |
---|
337 | readonly = False, |
---|
338 | default = [], |
---|
339 | ) |
---|
340 | # Replaced by first and second sitting |
---|
341 | #pp_school = schema.Choice( |
---|
342 | # title = _(u'Qualification Obtained'), |
---|
343 | # required = False, |
---|
344 | # readonly = False, |
---|
345 | # vocabulary = exam_types, |
---|
346 | # ) |
---|
347 | presently_inst = schema.TextLine( |
---|
348 | title = _(u'If yes, name of institution'), |
---|
349 | required = False, |
---|
350 | readonly = False, |
---|
351 | ) |
---|
352 | nysc_year = schema.Int( |
---|
353 | title = _(u'Nysc Year'), |
---|
354 | required = False, |
---|
355 | readonly = False, |
---|
356 | ) |
---|
357 | nysc_lga = schema.Choice( |
---|
358 | source = LGASource(), |
---|
359 | title = _(u'Nysc Location'), |
---|
360 | required = False, |
---|
361 | ) |
---|
362 | employer = schema.TextLine( |
---|
363 | title = _(u'Employer'), |
---|
364 | required = False, |
---|
365 | readonly = False, |
---|
366 | ) |
---|
367 | emp_position = schema.TextLine( |
---|
368 | title = _(u'Employer Position'), |
---|
369 | required = False, |
---|
370 | readonly = False, |
---|
371 | ) |
---|
372 | emp_start = FormattedDate( |
---|
373 | title = _(u'Start Date'), |
---|
374 | required = False, |
---|
375 | readonly = False, |
---|
376 | show_year = True, |
---|
377 | ) |
---|
378 | emp_end = FormattedDate( |
---|
379 | title = _(u'End Date'), |
---|
380 | required = False, |
---|
381 | readonly = False, |
---|
382 | show_year = True, |
---|
383 | ) |
---|
384 | emp_reason = schema.TextLine( |
---|
385 | title = _(u'Reason for Leaving'), |
---|
386 | required = False, |
---|
387 | readonly = False, |
---|
388 | ) |
---|
389 | employer2 = schema.TextLine( |
---|
390 | title = _(u'2nd Employer'), |
---|
391 | required = False, |
---|
392 | readonly = False, |
---|
393 | ) |
---|
394 | emp2_position = schema.TextLine( |
---|
395 | title = _(u'2nd Employer Position'), |
---|
396 | required = False, |
---|
397 | readonly = False, |
---|
398 | ) |
---|
399 | emp2_start = FormattedDate( |
---|
400 | title = _(u'Start Date'), |
---|
401 | required = False, |
---|
402 | readonly = False, |
---|
403 | show_year = True, |
---|
404 | ) |
---|
405 | emp2_end = FormattedDate( |
---|
406 | title = _(u'End Date'), |
---|
407 | required = False, |
---|
408 | readonly = False, |
---|
409 | show_year = True, |
---|
410 | ) |
---|
411 | emp2_reason = schema.TextLine( |
---|
412 | title = _(u'Reason for Leaving'), |
---|
413 | required = False, |
---|
414 | readonly = False, |
---|
415 | ) |
---|
416 | notice = schema.Text( |
---|
417 | title = _(u'Notice'), |
---|
418 | required = False, |
---|
419 | readonly = False, |
---|
420 | ) |
---|
421 | screening_venue = schema.TextLine( |
---|
422 | title = _(u'Screening Venue'), |
---|
423 | required = False, |
---|
424 | ) |
---|
425 | screening_date = schema.TextLine( |
---|
426 | title = _(u'Screening Date'), |
---|
427 | required = False, |
---|
428 | ) |
---|
429 | screening_score = schema.Int( |
---|
430 | title = _(u'Screening Score (%)'), |
---|
431 | required = False, |
---|
432 | ) |
---|
433 | student_id = schema.TextLine( |
---|
434 | title = _(u'Student Id'), |
---|
435 | required = False, |
---|
436 | readonly = False, |
---|
437 | ) |
---|
438 | course_admitted = schema.Choice( |
---|
439 | title = _(u'Admitted Course of Study'), |
---|
440 | source = CertificateSource(), |
---|
441 | required = False, |
---|
442 | readonly = False, |
---|
443 | ) |
---|
444 | locked = schema.Bool( |
---|
445 | title = _(u'Form locked'), |
---|
446 | default = False, |
---|
447 | required = False, |
---|
448 | ) |
---|
449 | |
---|
450 | INigeriaPGApplicant[ |
---|
451 | 'locked'].order = IApplicantBaseData['suspended'].order |
---|
452 | |
---|
453 | class INigeriaApplicant(INigeriaUGApplicant, INigeriaPGApplicant): |
---|
454 | """An interface for both types of applicants. |
---|
455 | |
---|
456 | Attention: The INigeriaPGApplicant field seetings will be overwritten |
---|
457 | by INigeriaPGApplicant field settings. If a field is defined |
---|
458 | in both interfaces zope.schema validates only against the |
---|
459 | constraints in INigeriaUGApplicant. This does not affect the forms |
---|
460 | since they are build on either INigeriaUGApplicant or INigeriaPGApplicant. |
---|
461 | """ |
---|
462 | |
---|
463 | def writeLogMessage(view, comment): |
---|
464 | """Adds an INFO message to the log file |
---|
465 | """ |
---|
466 | |
---|
467 | def createStudent(): |
---|
468 | """Create a student object from applicant data |
---|
469 | and copy applicant object. |
---|
470 | """ |
---|
471 | |
---|
472 | class INigeriaUGApplicantEdit(INigeriaUGApplicant): |
---|
473 | """An undergraduate applicant interface for edit forms. |
---|
474 | |
---|
475 | Here we can repeat the fields from base data and set the |
---|
476 | `required` and `readonly` attributes to True to further restrict |
---|
477 | the data access. Or we can allow only certain certificates to be |
---|
478 | selected by choosing the appropriate source. |
---|
479 | |
---|
480 | We cannot omit fields here. This has to be done in the |
---|
481 | respective form page. |
---|
482 | """ |
---|
483 | |
---|
484 | email = schema.ASCIILine( |
---|
485 | title = _(u'Email Address'), |
---|
486 | required = True, |
---|
487 | constraint=validate_email, |
---|
488 | ) |
---|
489 | date_of_birth = FormattedDate( |
---|
490 | title = _(u'Date of Birth'), |
---|
491 | required = True, |
---|
492 | show_year = True, |
---|
493 | ) |
---|
494 | |
---|
495 | INigeriaUGApplicantEdit[ |
---|
496 | 'date_of_birth'].order = INigeriaUGApplicant['date_of_birth'].order |
---|
497 | INigeriaUGApplicantEdit[ |
---|
498 | 'email'].order = INigeriaUGApplicant['email'].order |
---|
499 | |
---|
500 | class INigeriaPGApplicantEdit(INigeriaPGApplicant): |
---|
501 | """A postgraduate applicant interface for editing. |
---|
502 | |
---|
503 | Here we can repeat the fields from base data and set the |
---|
504 | `required` and `readonly` attributes to True to further restrict |
---|
505 | the data access. Or we can allow only certain certificates to be |
---|
506 | selected by choosing the appropriate source. |
---|
507 | |
---|
508 | We cannot omit fields here. This has to be done in the |
---|
509 | respective form page. |
---|
510 | """ |
---|
511 | |
---|
512 | email = schema.ASCIILine( |
---|
513 | title = _(u'Email Address'), |
---|
514 | required = True, |
---|
515 | constraint=validate_email, |
---|
516 | ) |
---|
517 | date_of_birth = FormattedDate( |
---|
518 | title = _(u'Date of Birth'), |
---|
519 | required = True, |
---|
520 | show_year = True, |
---|
521 | ) |
---|
522 | |
---|
523 | INigeriaPGApplicantEdit[ |
---|
524 | 'date_of_birth'].order = INigeriaPGApplicant['date_of_birth'].order |
---|
525 | INigeriaPGApplicantEdit[ |
---|
526 | 'email'].order = INigeriaPGApplicant['email'].order |
---|
527 | |
---|
528 | class INigeriaApplicantOnlinePayment(INigeriaOnlinePayment): |
---|
529 | """An applicant payment via payment gateways. |
---|
530 | |
---|
531 | """ |
---|
532 | |
---|
533 | class IPUTMEApplicantEdit(INigeriaUGApplicant): |
---|
534 | """An undergraduate applicant interface for editing. |
---|
535 | |
---|
536 | Here we can repeat the fields from base data and set the |
---|
537 | `required` and `readonly` attributes to True to further restrict |
---|
538 | the data access. Or we can allow only certain certificates to be |
---|
539 | selected by choosing the appropriate source. |
---|
540 | |
---|
541 | We cannot omit fields here. This has to be done in the |
---|
542 | respective form page. |
---|
543 | """ |
---|
544 | email = schema.ASCIILine( |
---|
545 | title = _(u'Email Address'), |
---|
546 | required = True, |
---|
547 | constraint=validate_email, |
---|
548 | ) |
---|
549 | date_of_birth = FormattedDate( |
---|
550 | title = _(u'Date of Birth'), |
---|
551 | required = True, |
---|
552 | show_year = True, |
---|
553 | ) |
---|
554 | nationality = schema.Choice( |
---|
555 | source = nats_vocab, |
---|
556 | title = _(u'Nationality'), |
---|
557 | required = True, |
---|
558 | ) |
---|
559 | |
---|
560 | IPUTMEApplicantEdit[ |
---|
561 | 'date_of_birth'].order = INigeriaUGApplicant['date_of_birth'].order |
---|
562 | IPUTMEApplicantEdit[ |
---|
563 | 'email'].order = INigeriaUGApplicant['email'].order |
---|
564 | IPUTMEApplicantEdit[ |
---|
565 | 'nationality'].order = INigeriaUGApplicant['nationality'].order |
---|
566 | |
---|
567 | class INigeriaApplicantUpdateByRegNo(INigeriaApplicant): |
---|
568 | """Representation of an applicant. |
---|
569 | |
---|
570 | Skip regular reg_number validation if reg_number is used for finding |
---|
571 | the applicant object. |
---|
572 | """ |
---|
573 | reg_number = schema.TextLine( |
---|
574 | title = u'Registration Number', |
---|
575 | required = False, |
---|
576 | ) |
---|