1 | # -*- coding: utf-8 -*- |
---|
2 | ## $Id: interfaces.py 16078 2020-05-02 20:07:43Z henrik $ |
---|
3 | ## |
---|
4 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
5 | ## This program is free software; you can redistribute it and/or modify |
---|
6 | ## it under the terms of the GNU General Public License as published by |
---|
7 | ## the Free Software Foundation; either version 2 of the License, or |
---|
8 | ## (at your option) any later version. |
---|
9 | ## |
---|
10 | ## This program is distributed in the hope that it will be useful, |
---|
11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | ## GNU General Public License for more details. |
---|
14 | ## |
---|
15 | ## You should have received a copy of the GNU General Public License |
---|
16 | ## along with this program; if not, write to the Free Software |
---|
17 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
18 | ## |
---|
19 | """Customized interfaces of the university application package. |
---|
20 | """ |
---|
21 | |
---|
22 | #from grok import getSite |
---|
23 | from zope import schema |
---|
24 | #from zope.interface import invariant, Invalid |
---|
25 | #from zope.component import getUtility |
---|
26 | #from zope.catalog.interfaces import ICatalog |
---|
27 | from zc.sourcefactory.basic import BasicSourceFactory |
---|
28 | from waeup.kofa.applicants.interfaces import ( |
---|
29 | IApplicantBaseData, |
---|
30 | AppCatCertificateSource, CertificateSource) |
---|
31 | from waeup.kofa.university.vocabularies import StudyModeSource |
---|
32 | from waeup.kofa.students.vocabularies import ( |
---|
33 | nats_vocab, GenderSource, StudyLevelSource) |
---|
34 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
35 | from waeup.kofa.interfaces import ( |
---|
36 | SimpleKofaVocabulary, academic_sessions_vocab, validate_email, |
---|
37 | IKofaObject) |
---|
38 | from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber |
---|
39 | from waeup.kofa.students.vocabularies import ( |
---|
40 | nats_vocab, GenderSource) |
---|
41 | from waeup.kofa.refereeentries import RefereeEntryField |
---|
42 | from waeup.kofa.applicants.interfaces import contextual_reg_num_source |
---|
43 | from kofacustom.nigeria.interfaces import DisabilitiesSource |
---|
44 | from kofacustom.nigeria.applicants.interfaces import ( |
---|
45 | LGASource, high_qual, high_grade, exam_types, |
---|
46 | programme_types_vocab, jambsubjects, |
---|
47 | INigeriaUGApplicant, INigeriaPGApplicant, |
---|
48 | INigeriaApplicantOnlinePayment, |
---|
49 | INigeriaUGApplicantEdit, INigeriaPGApplicantEdit, |
---|
50 | INigeriaApplicantUpdateByRegNo, |
---|
51 | IPUTMEApplicantEdit, |
---|
52 | IBankAccount, |
---|
53 | ) |
---|
54 | from waeup.uniben.interfaces import MessageFactory as _ |
---|
55 | from waeup.uniben.payments.interfaces import ICustomOnlinePayment |
---|
56 | |
---|
57 | |
---|
58 | REGISTRATION_CATS = { |
---|
59 | 'corporate': ('Corporate Registration', 250000, 1), |
---|
60 | 'group': ('Group Registration', 200000, 2), |
---|
61 | 'individual': ('Individual Registration', 45000, 3), |
---|
62 | 'student': ('Student Registration', 5000, 4), |
---|
63 | 'fullpage': ('Full Page Advert', 250000, 5), |
---|
64 | 'halfpage': ('Half Page Advert', 150000, 6), |
---|
65 | 'quarterpage': ('Quarter Page Advert', 100000, 7), |
---|
66 | } |
---|
67 | |
---|
68 | class RegTypesSource(BasicSourceFactory): |
---|
69 | """A source that delivers all kinds of registrations. |
---|
70 | """ |
---|
71 | def getValues(self): |
---|
72 | sorted_items = sorted(REGISTRATION_CATS.items(), |
---|
73 | key=lambda element: element[1][2]) |
---|
74 | return [item[0] for item in sorted_items] |
---|
75 | |
---|
76 | def getTitle(self, value): |
---|
77 | return u"%s @ ₦ %s" % ( |
---|
78 | REGISTRATION_CATS[value][0], |
---|
79 | REGISTRATION_CATS[value][1]) |
---|
80 | |
---|
81 | class IUnibenRegistration(IKofaObject): |
---|
82 | """A Uniben registrant. |
---|
83 | """ |
---|
84 | |
---|
85 | suspended = schema.Bool( |
---|
86 | title = _(u'Account suspended'), |
---|
87 | default = False, |
---|
88 | required = False, |
---|
89 | ) |
---|
90 | |
---|
91 | locked = schema.Bool( |
---|
92 | title = _(u'Form locked'), |
---|
93 | default = False, |
---|
94 | required = False, |
---|
95 | ) |
---|
96 | |
---|
97 | applicant_id = schema.TextLine( |
---|
98 | title = _(u'Registrant Id'), |
---|
99 | required = False, |
---|
100 | readonly = False, |
---|
101 | ) |
---|
102 | |
---|
103 | firstname = schema.TextLine( |
---|
104 | title = _(u'First Name'), |
---|
105 | required = True, |
---|
106 | ) |
---|
107 | |
---|
108 | middlename = schema.TextLine( |
---|
109 | title = _(u'Middle Name'), |
---|
110 | required = False, |
---|
111 | ) |
---|
112 | |
---|
113 | lastname = schema.TextLine( |
---|
114 | title = _(u'Last Name (Surname)'), |
---|
115 | required = True, |
---|
116 | ) |
---|
117 | |
---|
118 | sex = schema.Choice( |
---|
119 | title = _(u'Sex'), |
---|
120 | source = GenderSource(), |
---|
121 | required = True, |
---|
122 | ) |
---|
123 | |
---|
124 | nationality = schema.Choice( |
---|
125 | vocabulary = nats_vocab, |
---|
126 | title = _(u'Nationality'), |
---|
127 | required = False, |
---|
128 | ) |
---|
129 | |
---|
130 | email = schema.ASCIILine( |
---|
131 | title = _(u'Email Address'), |
---|
132 | required = True, |
---|
133 | constraint=validate_email, |
---|
134 | ) |
---|
135 | |
---|
136 | phone = PhoneNumber( |
---|
137 | title = _(u'Phone'), |
---|
138 | description = u'', |
---|
139 | required = False, |
---|
140 | ) |
---|
141 | |
---|
142 | #perm_address = schema.Text( |
---|
143 | # title = _(u'Current Local Address'), |
---|
144 | # required = False, |
---|
145 | # readonly = False, |
---|
146 | # ) |
---|
147 | |
---|
148 | institution = schema.TextLine( |
---|
149 | title = _(u'Institution/Organisation'), |
---|
150 | required = False, |
---|
151 | readonly = False, |
---|
152 | ) |
---|
153 | |
---|
154 | city = schema.TextLine( |
---|
155 | title = _(u'City'), |
---|
156 | required = False, |
---|
157 | readonly = False, |
---|
158 | ) |
---|
159 | |
---|
160 | lga = schema.Choice( |
---|
161 | source = LGASource(), |
---|
162 | title = _(u'State/LGA'), |
---|
163 | required = False, |
---|
164 | ) |
---|
165 | |
---|
166 | matric_number = schema.TextLine( |
---|
167 | title = _(u'Uniben Matriculation Number'), |
---|
168 | required = False, |
---|
169 | readonly = False, |
---|
170 | ) |
---|
171 | |
---|
172 | registration_cats = schema.List( |
---|
173 | title = _(u'Registration Categories'), |
---|
174 | value_type = schema.Choice(source=RegTypesSource()), |
---|
175 | required = True, |
---|
176 | defaultFactory=list, |
---|
177 | ) |
---|
178 | |
---|
179 | # @invariant |
---|
180 | # def matric_number_exists(applicant): |
---|
181 | # if applicant.matric_number: |
---|
182 | # catalog = getUtility(ICatalog, name='students_catalog') |
---|
183 | # accommodation_session = getSite()['hostels'].accommodation_session |
---|
184 | # student = catalog.searchResults(matric_number=( |
---|
185 | # applicant.matric_number, applicant.matric_number)) |
---|
186 | # if len(student) != 1: |
---|
187 | # raise Invalid(_("Matriculation number not found.")) |
---|
188 | |
---|
189 | class ITranscriptApplicant(IKofaObject): |
---|
190 | """A transcript applicant. |
---|
191 | """ |
---|
192 | |
---|
193 | suspended = schema.Bool( |
---|
194 | title = _(u'Account suspended'), |
---|
195 | default = False, |
---|
196 | required = False, |
---|
197 | ) |
---|
198 | |
---|
199 | locked = schema.Bool( |
---|
200 | title = _(u'Form locked'), |
---|
201 | default = False, |
---|
202 | required = False, |
---|
203 | ) |
---|
204 | |
---|
205 | applicant_id = schema.TextLine( |
---|
206 | title = _(u'Application Id'), |
---|
207 | required = False, |
---|
208 | readonly = False, |
---|
209 | ) |
---|
210 | |
---|
211 | reg_number = TextLineChoice( |
---|
212 | title = _(u'Kofa Registration Number'), |
---|
213 | readonly = False, |
---|
214 | required = True, |
---|
215 | source = contextual_reg_num_source, |
---|
216 | ) |
---|
217 | |
---|
218 | firstname = schema.TextLine( |
---|
219 | title = _(u'First Name'), |
---|
220 | required = True, |
---|
221 | ) |
---|
222 | |
---|
223 | middlename = schema.TextLine( |
---|
224 | title = _(u'Middle Name'), |
---|
225 | required = False, |
---|
226 | ) |
---|
227 | |
---|
228 | lastname = schema.TextLine( |
---|
229 | title = _(u'Last Name (Surname)'), |
---|
230 | required = True, |
---|
231 | ) |
---|
232 | |
---|
233 | matric_number = schema.TextLine( |
---|
234 | title = _(u'Matriculation Number'), |
---|
235 | readonly = False, |
---|
236 | required = True, |
---|
237 | ) |
---|
238 | |
---|
239 | date_of_birth = FormattedDate( |
---|
240 | title = _(u'Date of Birth'), |
---|
241 | required = False, |
---|
242 | #date_format = u'%d/%m/%Y', # Use grok-instance-wide default |
---|
243 | show_year = True, |
---|
244 | ) |
---|
245 | |
---|
246 | sex = schema.Choice( |
---|
247 | title = _(u'Gender'), |
---|
248 | source = GenderSource(), |
---|
249 | required = True, |
---|
250 | ) |
---|
251 | |
---|
252 | place_of_birth = schema.TextLine( |
---|
253 | title = _(u'Place of Birth'), |
---|
254 | readonly = False, |
---|
255 | required = False, |
---|
256 | ) |
---|
257 | |
---|
258 | nationality = schema.Choice( |
---|
259 | vocabulary = nats_vocab, |
---|
260 | title = _(u'Nationality'), |
---|
261 | required = False, |
---|
262 | ) |
---|
263 | |
---|
264 | email = schema.ASCIILine( |
---|
265 | title = _(u'Email Address'), |
---|
266 | required = True, |
---|
267 | constraint=validate_email, |
---|
268 | ) |
---|
269 | |
---|
270 | phone = PhoneNumber( |
---|
271 | title = _(u'Phone'), |
---|
272 | description = u'', |
---|
273 | required = False, |
---|
274 | ) |
---|
275 | |
---|
276 | perm_address = schema.Text( |
---|
277 | title = _(u'Current Local Address'), |
---|
278 | required = False, |
---|
279 | readonly = False, |
---|
280 | ) |
---|
281 | |
---|
282 | dispatch_address = schema.Text( |
---|
283 | title = _(u'Dispatch Addresses'), |
---|
284 | description = u'Addresses to which transcript should be posted.', |
---|
285 | required = False, |
---|
286 | readonly = False, |
---|
287 | ) |
---|
288 | |
---|
289 | entry_mode = schema.Choice( |
---|
290 | title = _(u'Entry Mode'), |
---|
291 | source = StudyModeSource(), |
---|
292 | required = False, |
---|
293 | readonly = False, |
---|
294 | ) |
---|
295 | |
---|
296 | entry_session = schema.Choice( |
---|
297 | title = _(u'Entry Session'), |
---|
298 | source = academic_sessions_vocab, |
---|
299 | required = False, |
---|
300 | readonly = False, |
---|
301 | ) |
---|
302 | |
---|
303 | end_session = schema.Choice( |
---|
304 | title = _(u'End Session'), |
---|
305 | source = academic_sessions_vocab, |
---|
306 | required = False, |
---|
307 | readonly = False, |
---|
308 | ) |
---|
309 | |
---|
310 | course_studied = schema.Choice( |
---|
311 | title = _(u'Course of Study / Degree'), |
---|
312 | source = CertificateSource(), |
---|
313 | required = False, |
---|
314 | readonly = False, |
---|
315 | ) |
---|
316 | |
---|
317 | purpose = schema.TextLine( |
---|
318 | title = _(u'Purpose of this Application'), |
---|
319 | readonly = False, |
---|
320 | required = False, |
---|
321 | ) |
---|
322 | |
---|
323 | course_changed = schema.Choice( |
---|
324 | title = _(u'Change of Study Course'), |
---|
325 | description = u'If yes, select previous course of study.', |
---|
326 | source = CertificateSource(), |
---|
327 | readonly = False, |
---|
328 | required = False, |
---|
329 | ) |
---|
330 | |
---|
331 | change_level = schema.Choice( |
---|
332 | title = _(u'Change Level'), |
---|
333 | description = u'If yes, select level at which you changed course of study.', |
---|
334 | source = StudyLevelSource(), |
---|
335 | required = False, |
---|
336 | readonly = False, |
---|
337 | ) |
---|
338 | |
---|
339 | no_copies = schema.Choice( |
---|
340 | title = _(u'Number of Copies'), |
---|
341 | description = u'Must correspond with the number of dispatch addresses above.', |
---|
342 | values=[1, 2, 3, 4], |
---|
343 | required = False, |
---|
344 | readonly = False, |
---|
345 | default = 1, |
---|
346 | ) |
---|
347 | |
---|
348 | class ICustomUGApplicant(IApplicantBaseData, IBankAccount): |
---|
349 | """An undergraduate applicant. |
---|
350 | |
---|
351 | This interface defines the least common multiple of all fields |
---|
352 | in ug application forms. In customized forms, fields can be excluded by |
---|
353 | adding them to the UG_OMIT* tuples. |
---|
354 | """ |
---|
355 | |
---|
356 | disabilities = schema.Choice( |
---|
357 | title = _(u'Disabilities'), |
---|
358 | source = DisabilitiesSource(), |
---|
359 | required = False, |
---|
360 | ) |
---|
361 | nationality = schema.Choice( |
---|
362 | source = nats_vocab, |
---|
363 | title = _(u'Nationality'), |
---|
364 | required = False, |
---|
365 | ) |
---|
366 | lga = schema.Choice( |
---|
367 | source = LGASource(), |
---|
368 | title = _(u'State/LGA (Nigerians only)'), |
---|
369 | required = False, |
---|
370 | ) |
---|
371 | #perm_address = schema.Text( |
---|
372 | # title = _(u'Permanent Address'), |
---|
373 | # required = False, |
---|
374 | # ) |
---|
375 | course1 = schema.Choice( |
---|
376 | title = _(u'1st Choice Course of Study'), |
---|
377 | source = AppCatCertificateSource(), |
---|
378 | required = True, |
---|
379 | ) |
---|
380 | course2 = schema.Choice( |
---|
381 | title = _(u'2nd Choice Course of Study'), |
---|
382 | source = AppCatCertificateSource(), |
---|
383 | required = False, |
---|
384 | ) |
---|
385 | |
---|
386 | programme_type = schema.Choice( |
---|
387 | title = _(u'Programme Type'), |
---|
388 | vocabulary = programme_types_vocab, |
---|
389 | required = False, |
---|
390 | ) |
---|
391 | |
---|
392 | hq_type = schema.Choice( |
---|
393 | title = _(u'Qualification Obtained'), |
---|
394 | required = False, |
---|
395 | readonly = False, |
---|
396 | vocabulary = high_qual, |
---|
397 | ) |
---|
398 | hq_matric_no = schema.TextLine( |
---|
399 | title = _(u'Former Matric Number'), |
---|
400 | required = False, |
---|
401 | readonly = False, |
---|
402 | ) |
---|
403 | hq_degree = schema.Choice( |
---|
404 | title = _(u'Class of Degree'), |
---|
405 | required = False, |
---|
406 | readonly = False, |
---|
407 | vocabulary = high_grade, |
---|
408 | ) |
---|
409 | hq_school = schema.TextLine( |
---|
410 | title = _(u'Institution Attended'), |
---|
411 | required = False, |
---|
412 | readonly = False, |
---|
413 | ) |
---|
414 | hq_session = schema.TextLine( |
---|
415 | title = _(u'Years Attended'), |
---|
416 | required = False, |
---|
417 | readonly = False, |
---|
418 | ) |
---|
419 | hq_disc = schema.TextLine( |
---|
420 | title = _(u'Discipline'), |
---|
421 | required = False, |
---|
422 | readonly = False, |
---|
423 | ) |
---|
424 | fst_sit_fname = schema.TextLine( |
---|
425 | title = _(u'Full Name'), |
---|
426 | required = False, |
---|
427 | readonly = False, |
---|
428 | ) |
---|
429 | fst_sit_no = schema.TextLine( |
---|
430 | title = _(u'Exam Number'), |
---|
431 | required = False, |
---|
432 | readonly = False, |
---|
433 | ) |
---|
434 | fst_sit_date = FormattedDate( |
---|
435 | title = _(u'Exam Date'), |
---|
436 | required = False, |
---|
437 | readonly = False, |
---|
438 | show_year = True, |
---|
439 | ) |
---|
440 | fst_sit_type = schema.Choice( |
---|
441 | title = _(u'Exam Type'), |
---|
442 | required = False, |
---|
443 | readonly = False, |
---|
444 | vocabulary = exam_types, |
---|
445 | ) |
---|
446 | fst_sit_results = schema.List( |
---|
447 | title = _(u'Exam Results'), |
---|
448 | value_type = ResultEntryField(), |
---|
449 | required = False, |
---|
450 | readonly = False, |
---|
451 | defaultFactory=list, |
---|
452 | ) |
---|
453 | scd_sit_fname = schema.TextLine( |
---|
454 | title = _(u'Full Name'), |
---|
455 | required = False, |
---|
456 | readonly = False, |
---|
457 | ) |
---|
458 | scd_sit_no = schema.TextLine( |
---|
459 | title = _(u'Exam Number'), |
---|
460 | required = False, |
---|
461 | readonly = False, |
---|
462 | ) |
---|
463 | scd_sit_date = FormattedDate( |
---|
464 | title = _(u'Exam Date'), |
---|
465 | required = False, |
---|
466 | readonly = False, |
---|
467 | show_year = True, |
---|
468 | ) |
---|
469 | scd_sit_type = schema.Choice( |
---|
470 | title = _(u'Exam Type'), |
---|
471 | required = False, |
---|
472 | readonly = False, |
---|
473 | vocabulary = exam_types, |
---|
474 | ) |
---|
475 | scd_sit_results = schema.List( |
---|
476 | title = _(u'Exam Results'), |
---|
477 | value_type = ResultEntryField(), |
---|
478 | required = False, |
---|
479 | readonly = False, |
---|
480 | defaultFactory=list, |
---|
481 | ) |
---|
482 | jamb_subjects = schema.Text( |
---|
483 | title = _(u'Subjects and Scores'), |
---|
484 | required = False, |
---|
485 | ) |
---|
486 | jamb_subjects_list = schema.List( |
---|
487 | title = _(u'JAMB Subjects'), |
---|
488 | required = False, |
---|
489 | defaultFactory=list, |
---|
490 | value_type = schema.Choice( |
---|
491 | vocabulary = jambsubjects |
---|
492 | #source = JAMBSubjectSource(), |
---|
493 | ), |
---|
494 | ) |
---|
495 | jamb_score = schema.Int( |
---|
496 | title = _(u'Total JAMB Score'), |
---|
497 | required = False, |
---|
498 | ) |
---|
499 | #jamb_age = schema.Int( |
---|
500 | # title = _(u'Age (provided by JAMB)'), |
---|
501 | # required = False, |
---|
502 | # ) |
---|
503 | jamb_reg_number = schema.TextLine( |
---|
504 | title = _(u'JAMB Registration Number'), |
---|
505 | required = False, |
---|
506 | ) |
---|
507 | notice = schema.Text( |
---|
508 | title = _(u'Notice'), |
---|
509 | required = False, |
---|
510 | ) |
---|
511 | screening_venue = schema.TextLine( |
---|
512 | title = _(u'Screening Venue'), |
---|
513 | required = False, |
---|
514 | ) |
---|
515 | screening_date = schema.TextLine( |
---|
516 | title = _(u'Screening Date'), |
---|
517 | required = False, |
---|
518 | ) |
---|
519 | screening_score = schema.Int( |
---|
520 | title = _(u'Screening Score (%)'), |
---|
521 | required = False, |
---|
522 | ) |
---|
523 | aggregate = schema.Int( |
---|
524 | title = _(u'Aggregate Score (%)'), |
---|
525 | description = _(u'(average of relative JAMB and PUTME scores)'), |
---|
526 | required = False, |
---|
527 | ) |
---|
528 | result_uploaded = schema.Bool( |
---|
529 | title = _(u'Result uploaded'), |
---|
530 | default = False, |
---|
531 | required = False, |
---|
532 | ) |
---|
533 | student_id = schema.TextLine( |
---|
534 | title = _(u'Student Id'), |
---|
535 | required = False, |
---|
536 | readonly = False, |
---|
537 | ) |
---|
538 | course_admitted = schema.Choice( |
---|
539 | title = _(u'Admitted Course of Study'), |
---|
540 | source = CertificateSource(), |
---|
541 | required = False, |
---|
542 | ) |
---|
543 | locked = schema.Bool( |
---|
544 | title = _(u'Form locked'), |
---|
545 | default = False, |
---|
546 | required = False, |
---|
547 | ) |
---|
548 | |
---|
549 | ICustomUGApplicant[ |
---|
550 | 'locked'].order = IApplicantBaseData['suspended'].order |
---|
551 | ICustomUGApplicant[ |
---|
552 | 'result_uploaded'].order = ICustomUGApplicant['suspended'].order |
---|
553 | |
---|
554 | class ICustomPGApplicant(INigeriaPGApplicant): |
---|
555 | """A postgraduate applicant. |
---|
556 | |
---|
557 | This interface defines the least common multiple of all fields |
---|
558 | in pg application forms. In customized forms, fields can be excluded by |
---|
559 | adding them to the PG_OMIT* tuples. |
---|
560 | """ |
---|
561 | |
---|
562 | referees = schema.List( |
---|
563 | title = _(u'Referees'), |
---|
564 | value_type = RefereeEntryField(), |
---|
565 | required = False, |
---|
566 | defaultFactory=list, |
---|
567 | ) |
---|
568 | |
---|
569 | ICustomPGApplicant[ |
---|
570 | 'referees'].order = INigeriaPGApplicant['emp2_reason'].order |
---|
571 | |
---|
572 | class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant, |
---|
573 | IUnibenRegistration, ITranscriptApplicant): |
---|
574 | """An interface for both types of applicants. |
---|
575 | |
---|
576 | Attention: The ICustomPGApplicant field seetings will be overwritten |
---|
577 | by ICustomPGApplicant field settings. If a field is defined |
---|
578 | in both interfaces zope.schema validates only against the |
---|
579 | constraints in ICustomUGApplicant. This does not affect the forms |
---|
580 | since they are build on either ICustomUGApplicant or ICustomPGApplicant. |
---|
581 | """ |
---|
582 | |
---|
583 | def writeLogMessage(view, comment): |
---|
584 | """Adds an INFO message to the log file |
---|
585 | """ |
---|
586 | |
---|
587 | def createStudent(): |
---|
588 | """Create a student object from applicant data |
---|
589 | and copy applicant object. |
---|
590 | """ |
---|
591 | |
---|
592 | class ICustomUGApplicantEdit(ICustomUGApplicant): |
---|
593 | """An undergraduate applicant interface for edit forms. |
---|
594 | |
---|
595 | Here we can repeat the fields from base data and set the |
---|
596 | `required` and `readonly` attributes to True to further restrict |
---|
597 | the data access. Or we can allow only certain certificates to be |
---|
598 | selected by choosing the appropriate source. |
---|
599 | |
---|
600 | We cannot omit fields here. This has to be done in the |
---|
601 | respective form page. |
---|
602 | """ |
---|
603 | |
---|
604 | email = schema.ASCIILine( |
---|
605 | title = _(u'Email Address'), |
---|
606 | required = True, |
---|
607 | constraint=validate_email, |
---|
608 | ) |
---|
609 | date_of_birth = FormattedDate( |
---|
610 | title = _(u'Date of Birth'), |
---|
611 | required = True, |
---|
612 | show_year = True, |
---|
613 | ) |
---|
614 | |
---|
615 | ICustomUGApplicantEdit[ |
---|
616 | 'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order |
---|
617 | ICustomUGApplicantEdit[ |
---|
618 | 'email'].order = ICustomUGApplicant['email'].order |
---|
619 | |
---|
620 | class ICustomPGApplicantEdit(INigeriaPGApplicantEdit): |
---|
621 | """A postgraduate applicant interface for editing. |
---|
622 | |
---|
623 | Here we can repeat the fields from base data and set the |
---|
624 | `required` and `readonly` attributes to True to further restrict |
---|
625 | the data access. Or we can allow only certain certificates to be |
---|
626 | selected by choosing the appropriate source. |
---|
627 | |
---|
628 | We cannot omit fields here. This has to be done in the |
---|
629 | respective form page. |
---|
630 | """ |
---|
631 | |
---|
632 | referees = schema.List( |
---|
633 | title = _(u'Referees'), |
---|
634 | value_type = RefereeEntryField(), |
---|
635 | required = False, |
---|
636 | defaultFactory=list, |
---|
637 | ) |
---|
638 | |
---|
639 | ICustomPGApplicantEdit[ |
---|
640 | 'referees'].order = INigeriaPGApplicantEdit['emp2_reason'].order |
---|
641 | |
---|
642 | class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): |
---|
643 | """An applicant payment via payment gateways. |
---|
644 | |
---|
645 | """ |
---|
646 | |
---|
647 | class IPUTMEApplicantEdit(ICustomUGApplicant): |
---|
648 | """An undergraduate applicant interface for editing. |
---|
649 | |
---|
650 | Here we can repeat the fields from base data and set the |
---|
651 | `required` and `readonly` attributes to True to further restrict |
---|
652 | the data access. Or we can allow only certain certificates to be |
---|
653 | selected by choosing the appropriate source. |
---|
654 | |
---|
655 | We cannot omit fields here. This has to be done in the |
---|
656 | respective form page. |
---|
657 | """ |
---|
658 | |
---|
659 | email = schema.ASCIILine( |
---|
660 | title = _(u'Email Address'), |
---|
661 | required = True, |
---|
662 | constraint=validate_email, |
---|
663 | ) |
---|
664 | date_of_birth = FormattedDate( |
---|
665 | title = _(u'Date of Birth'), |
---|
666 | required = True, |
---|
667 | show_year = True, |
---|
668 | ) |
---|
669 | nationality = schema.Choice( |
---|
670 | source = nats_vocab, |
---|
671 | title = _(u'Nationality'), |
---|
672 | required = True, |
---|
673 | ) |
---|
674 | |
---|
675 | IPUTMEApplicantEdit[ |
---|
676 | 'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order |
---|
677 | IPUTMEApplicantEdit[ |
---|
678 | 'email'].order = ICustomUGApplicant['email'].order |
---|
679 | IPUTMEApplicantEdit[ |
---|
680 | 'nationality'].order = ICustomUGApplicant['nationality'].order |
---|
681 | |
---|
682 | class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo): |
---|
683 | """Representation of an applicant. |
---|
684 | |
---|
685 | Skip regular reg_number validation if reg_number is used for finding |
---|
686 | the applicant object. |
---|
687 | """ |
---|