source: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/interfaces.py @ 14045

Last change on this file since 14045 was 14045, checked in by Henrik Bettermann, 8 years ago

Hide bak account data except for PUTME application.

  • Property svn:keywords set to Id
File size: 23.2 KB
Line 
1## $Id: interfaces.py 14045 2016-08-03 08:28:39Z 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
21from zope import schema
22from zope.component import getUtility
23from zope.schema import getFields
24from waeup.kofa.applicants.interfaces import (
25    contextual_reg_num_source,
26    IApplicantBaseData,
27    AppCatCertificateSource, CertificateSource)
28from waeup.kofa.schoolgrades import ResultEntryField
29from waeup.kofa.interfaces import (
30    SimpleKofaVocabulary,
31    academic_sessions_vocab,
32    validate_email,
33    SubjectSource,
34    IKofaUtils,
35    IKofaObject)
36from waeup.kofa.schema import FormattedDate, TextLineChoice
37from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
38from kofacustom.nigeria.interfaces import (
39    LGASource, high_qual, high_grade, exam_types)
40from kofacustom.nigeria.interfaces import MessageFactory as _
41from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment
42
43programme_types_vocab = SimpleKofaVocabulary(
44    (_('Post UTME'), 'putme'),
45    (_('Post DE'), 'pude'),
46    (_('Admission Screening Exercise'), 'ase'),
47    (_('not applicable'), 'na'),
48    )
49
50jambsubjects = SimpleKofaVocabulary(
51    (_('Use of English'),'english_language'),
52    (_('Agricultural Science'),'agricultural_science'),
53    (_('Arabic'),'arabic'),
54    (_('Biology'),'biology'),
55    (_('Book Keeping'),'book_keeping'),
56    (_('Chemistry'),'chemistry'),
57    (_('Christian Religious Studies'),'christian_religious_studies'),
58    (_('Commerce'),'commerce'),
59    (_('Economics'),'economics'),
60    (_('Financial Accounting'),'financial_accounting'),
61    (_('Fine Art'),'fine_art'),
62    (_('Food and Nutrition'),'food_and_nutrition'),
63    (_('French'),'french'),
64    (_('Geography'),'geography'),
65    (_('German'),'german'),
66    (_('Government'),'government'),
67    (_('Hausa'),'hausa'),
68    (_('Home Economics'),'home_economics'),
69    (_('History'),'history'),
70    (_('Igbo'),'igbo'),
71    (_('Literature in English'),'literature_in_english'),
72    (_('Literature in Nigerian Languages'),'literature_in_nigerian_languages'),
73    (_('Mathematics'),'mathematics'),
74    (_('Music'),'music'),
75    (_('Physics'),'physics'),
76    (_('Yoruba'),'yoruba'),
77    )
78
79# Define a validation method for jamb subjects
80class NotExactNumberOfItems(schema.ValidationError):
81    __doc__ = u"Not exactly 4 items selected."
82
83def four_items(value):
84    if len(value) and len(value) != 4:
85        raise NotExactNumberOfItems(value)
86    return True
87
88class JAMBSubjectSource(SubjectSource):
89    """A source for school subjects used in exam documentation.
90    """
91
92    def getTitle(self, value):
93        subjects_dict = getUtility(IKofaUtils).EXAM_SUBJECTS_DICT
94        return "%s" % subjects_dict[value]
95
96# Fields to be omitted in all display forms. course_admitted is
97# rendered separately.
98
99OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted',
100    'result_uploaded', 'suspended', 'special_application',
101    'bank_account_number',
102    'bank_account_name',
103    'bank_name')
104
105# UG students are all undergraduate students.
106UG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + (
107    'jamb_subjects_list', 'programme_type')
108UG_OMIT_PDF_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('phone',)
109UG_OMIT_MANAGE_FIELDS = (
110    'special_application',
111    'jamb_subjects_list',
112    'programme_type')
113UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + (
114    'student_id',
115    'notice',
116    'screening_score',
117    'screening_venue',
118    'screening_date',
119    'jamb_age',
120    'jamb_subjects',
121    'jamb_score',
122    'jamb_reg_number',
123    'aggregate')
124
125# CBT is a subgroup of UG with the same interface.
126CBT_OMIT_FIELDS = (
127    'hq_type', 'hq_matric_no',
128    'hq_degree', 'hq_school',
129    'hq_session', 'hq_disc',
130    'aggregate', 'jamb_subjects',
131    'programme_type')
132CBT_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + CBT_OMIT_FIELDS
133CBT_OMIT_MANAGE_FIELDS = CBT_OMIT_FIELDS + ('special_application',)
134CBT_OMIT_EDIT_FIELDS = OMIT_DISPLAY_FIELDS + CBT_OMIT_FIELDS + (
135    'special_application',
136    'student_id',
137    'notice',
138    'screening_score',
139    'screening_venue',
140    'screening_date',
141    #'jamb_age',
142    #'jamb_subjects',
143    #'jamb_score',
144    #'jamb_reg_number',
145    )
146CBT_OMIT_PDF_FIELDS = CBT_OMIT_DISPLAY_FIELDS + ('phone',)
147
148# AFFIL is a subgroup of UG with the same interface.
149AFFIL_OMIT_FIELDS = (
150    'hq_type', 'hq_matric_no',
151    'hq_degree', 'hq_school',
152    'hq_session', 'hq_disc',
153    'jamb_subjects')
154AFFIL_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + AFFIL_OMIT_FIELDS
155AFFIL_OMIT_MANAGE_FIELDS = AFFIL_OMIT_FIELDS + ('special_application',)
156AFFIL_OMIT_EDIT_FIELDS = OMIT_DISPLAY_FIELDS + AFFIL_OMIT_FIELDS + (
157    'special_application',
158    'student_id',
159    'notice',
160    'screening_score',
161    'screening_venue',
162    'screening_date',
163    'aggregate',
164    )
165AFFIL_OMIT_PDF_FIELDS = AFFIL_OMIT_DISPLAY_FIELDS + ('phone',)
166
167# PUTME is a subgroup of UG with the same interface.
168PUTME_OMIT_FIELDS = (
169    'hq_type', 'hq_matric_no',
170    'hq_degree', 'hq_school',
171    'hq_session', 'hq_disc',
172    'jamb_subjects_list', 'programme_type')
173
174# temporary solution to display bank account fields only
175# for PUTME (ase) application
176
177#PUTME_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUTME_OMIT_FIELDS
178PUTME_OMIT_DISPLAY_FIELDS = (
179    'locked', 'course_admitted', 'result_uploaded',
180    'suspended', 'special_application') + PUTME_OMIT_FIELDS
181
182PUTME_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUTME_OMIT_FIELDS
183PUTME_OMIT_EDIT_FIELDS = UG_OMIT_EDIT_FIELDS + PUTME_OMIT_FIELDS + (
184    'firstname', 'middlename', 'lastname', 'sex',
185    'course1', 'lga')
186PUTME_OMIT_PDF_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + ('phone',)
187PUTME_OMIT_RESULT_SLIP_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + (
188    'phone',
189    'date_of_birth', 'sex',
190    'nationality', 'lga', #'perm_address',
191    'course2', 'screening_venue',
192    'screening_date')
193
194# PUDE is a subgroup of UG with the same interface.
195PUDE_OMIT_FIELDS = (
196    'jamb_subjects',
197    'jamb_score',
198    'jamb_age',
199    'aggregate',
200    'jamb_subjects_list',
201    'programme_type')
202PUDE_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUDE_OMIT_FIELDS
203PUDE_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUDE_OMIT_FIELDS
204PUDE_OMIT_EDIT_FIELDS = set(UG_OMIT_EDIT_FIELDS + PUDE_OMIT_FIELDS + (
205    'firstname', 'middlename', 'lastname', 'sex',
206    'course1', 'lga'))
207PUDE_OMIT_PDF_FIELDS = PUDE_OMIT_DISPLAY_FIELDS + ('phone',)
208PUDE_OMIT_RESULT_SLIP_FIELDS = PUDE_OMIT_DISPLAY_FIELDS + (
209    'phone',
210    'date_of_birth', 'sex',
211    'nationality', 'lga', #'perm_address',
212    'course2', 'screening_venue',
213    'screening_date')
214
215# PG has its own interface
216PG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS
217PG_OMIT_PDF_FIELDS = PG_OMIT_DISPLAY_FIELDS + ('phone',)
218PG_OMIT_MANAGE_FIELDS = ('special_application',)
219PG_OMIT_EDIT_FIELDS = PG_OMIT_MANAGE_FIELDS + PG_OMIT_DISPLAY_FIELDS + (
220    'student_id', 'notice',
221    'screening_score', 'screening_venue',
222    'screening_date',)
223
224class IBankAccount(IKofaObject):
225
226    bank_name = schema.TextLine(
227        title = _(u'Bank Name'),
228        required = False,
229        readonly = False,
230        )
231
232    bank_account_name = schema.TextLine(
233        title = _(u'Bank Account Name'),
234        required = False,
235        readonly = False,
236        )
237
238    bank_account_number = schema.TextLine(
239        title = _(u'Bank Account Number'),
240        required = False,
241        readonly = False,
242        )
243
244class INigeriaUGApplicant(IApplicantBaseData, IBankAccount):
245    """An undergraduate applicant.
246
247    This interface defines the least common multiple of all fields
248    in ug application forms. In customized forms, fields can be excluded by
249    adding them to the UG_OMIT* tuples.
250    """
251
252    nationality = schema.Choice(
253        source = nats_vocab,
254        title = _(u'Nationality'),
255        required = False,
256        )
257    lga = schema.Choice(
258        source = LGASource(),
259        title = _(u'State/LGA (Nigerians only)'),
260        required = False,
261        )
262    #perm_address = schema.Text(
263    #    title = _(u'Permanent Address'),
264    #    required = False,
265    #    )
266    course1 = schema.Choice(
267        title = _(u'1st Choice Course of Study'),
268        source = AppCatCertificateSource(),
269        required = True,
270        )
271    course2 = schema.Choice(
272        title = _(u'2nd Choice Course of Study'),
273        source = AppCatCertificateSource(),
274        required = False,
275        )
276
277    programme_type = schema.Choice(
278        title = _(u'Programme Type'),
279        vocabulary = programme_types_vocab,
280        required = False,
281        )
282
283    hq_type = schema.Choice(
284        title = _(u'Qualification Obtained'),
285        required = False,
286        readonly = False,
287        vocabulary = high_qual,
288        )
289    hq_matric_no = schema.TextLine(
290        title = _(u'Former Matric Number'),
291        required = False,
292        readonly = False,
293        )
294    hq_degree = schema.Choice(
295        title = _(u'Class of Degree'),
296        required = False,
297        readonly = False,
298        vocabulary = high_grade,
299        )
300    hq_school = schema.TextLine(
301        title = _(u'Institution Attended'),
302        required = False,
303        readonly = False,
304        )
305    hq_session = schema.TextLine(
306        title = _(u'Years Attended'),
307        required = False,
308        readonly = False,
309        )
310    hq_disc = schema.TextLine(
311        title = _(u'Discipline'),
312        required = False,
313        readonly = False,
314        )
315    jamb_subjects = schema.Text(
316        title = _(u'Subjects and Scores'),
317        required = False,
318        )
319    jamb_subjects_list = schema.List(
320        title = _(u'JAMB Subjects'),
321        required = False,
322        defaultFactory=list,
323        value_type = schema.Choice(
324            vocabulary = jambsubjects
325            #source = JAMBSubjectSource(),
326            ),
327        )
328    jamb_score = schema.Int(
329        title = _(u'Total JAMB Score'),
330        required = False,
331        )
332    #jamb_age = schema.Int(
333    #    title = _(u'Age (provided by JAMB)'),
334    #    required = False,
335    #    )
336    jamb_reg_number = schema.TextLine(
337        title = _(u'JAMB Registration Number'),
338        required = False,
339        )
340    notice = schema.Text(
341        title = _(u'Notice'),
342        required = False,
343        )
344    screening_venue = schema.TextLine(
345        title = _(u'Screening Venue'),
346        required = False,
347        )
348    screening_date = schema.TextLine(
349        title = _(u'Screening Date'),
350        required = False,
351        )
352    screening_score = schema.Int(
353        title = _(u'Screening Score (%)'),
354        required = False,
355        )
356    aggregate = schema.Int(
357        title = _(u'Aggregate Score (%)'),
358        description = _(u'(average of relative JAMB and PUTME scores)'),
359        required = False,
360        )
361    result_uploaded = schema.Bool(
362        title = _(u'Result uploaded'),
363        default = False,
364        required = False,
365        )
366    student_id = schema.TextLine(
367        title = _(u'Student Id'),
368        required = False,
369        readonly = False,
370        )
371    course_admitted = schema.Choice(
372        title = _(u'Admitted Course of Study'),
373        source = CertificateSource(),
374        required = False,
375        )
376    locked = schema.Bool(
377        title = _(u'Form locked'),
378        default = False,
379        required = False,
380        )
381
382INigeriaUGApplicant[
383    'locked'].order =  IApplicantBaseData['suspended'].order
384INigeriaUGApplicant[
385    'result_uploaded'].order =  INigeriaUGApplicant['suspended'].order
386
387class INigeriaPGApplicant(IApplicantBaseData):
388    """A postgraduate applicant.
389
390    This interface defines the least common multiple of all fields
391    in pg application forms. In customized forms, fields can be excluded by
392    adding them to the PG_OMIT* tuples.
393    """
394
395    nationality = schema.Choice(
396        source = nats_vocab,
397        title = _(u'Nationality'),
398        required = True,
399        )
400    lga = schema.Choice(
401        source = LGASource(),
402        title = _(u'State/LGA (Nigerians only)'),
403        required = False,
404        )
405    #perm_address = schema.Text(
406    #    title = _(u'Permanent Address'),
407    #    required = False,
408    #    )
409    course1 = schema.Choice(
410        title = _(u'1st Choice Course of Study'),
411        source = AppCatCertificateSource(),
412        required = True,
413        )
414    course2 = schema.Choice(
415        title = _(u'2nd Choice Course of Study'),
416        source = AppCatCertificateSource(),
417        required = False,
418        )
419    hq_type = schema.Choice(
420        title = _(u'Qualification Obtained'),
421        required = False,
422        readonly = False,
423        vocabulary = high_qual,
424        )
425    hq_fname = schema.TextLine(
426        title = _(u'Full Name'),
427        required = False,
428        readonly = False,
429        )
430    hq_matric_no = schema.TextLine(
431        title = _(u'Former Matric Number'),
432        required = False,
433        readonly = False,
434        )
435    hq_degree = schema.Choice(
436        title = _(u'Class of Degree'),
437        required = False,
438        readonly = False,
439        vocabulary = high_grade,
440        )
441    hq_school = schema.TextLine(
442        title = _(u'Institution Attended'),
443        required = False,
444        readonly = False,
445        )
446    hq_session = schema.TextLine(
447        title = _(u'Years Attended'),
448        required = False,
449        readonly = False,
450        )
451    hq_disc = schema.TextLine(
452        title = _(u'Discipline'),
453        required = False,
454        readonly = False,
455        )
456    fst_sit_fname = schema.TextLine(
457        title = _(u'Full Name'),
458        required = False,
459        readonly = False,
460        )
461    fst_sit_no = schema.TextLine(
462        title = _(u'Exam Number'),
463        required = False,
464        readonly = False,
465        )
466    fst_sit_date = FormattedDate(
467        title = _(u'Exam Date'),
468        required = False,
469        readonly = False,
470        show_year = True,
471        )
472    fst_sit_type = schema.Choice(
473        title = _(u'Exam Type'),
474        required = False,
475        readonly = False,
476        vocabulary = exam_types,
477        )
478    fst_sit_results = schema.List(
479        title = _(u'Exam Results'),
480        value_type = ResultEntryField(),
481        required = False,
482        readonly = False,
483        defaultFactory=list,
484        )
485    scd_sit_fname = schema.TextLine(
486        title = _(u'Full Name'),
487        required = False,
488        readonly = False,
489        )
490    scd_sit_no = schema.TextLine(
491        title = _(u'Exam Number'),
492        required = False,
493        readonly = False,
494        )
495    scd_sit_date = FormattedDate(
496        title = _(u'Exam Date'),
497        required = False,
498        readonly = False,
499        show_year = True,
500        )
501    scd_sit_type = schema.Choice(
502        title = _(u'Exam Type'),
503        required = False,
504        readonly = False,
505        vocabulary = exam_types,
506        )
507    scd_sit_results = schema.List(
508        title = _(u'Exam Results'),
509        value_type = ResultEntryField(),
510        required = False,
511        readonly = False,
512        defaultFactory=list,
513        )
514    # Replaced by first and second sitting
515    #pp_school = schema.Choice(
516    #    title = _(u'Qualification Obtained'),
517    #    required = False,
518    #    readonly = False,
519    #    vocabulary = exam_types,
520    #    )
521    presently_inst = schema.TextLine(
522        title = _(u'If yes, name of institution'),
523        required = False,
524        readonly = False,
525        )
526    nysc_year = schema.Int(
527        title = _(u'Nysc Year'),
528        required = False,
529        readonly = False,
530        )
531    nysc_lga = schema.Choice(
532        source = LGASource(),
533        title = _(u'Nysc Location'),
534        required = False,
535        )
536    employer = schema.TextLine(
537        title = _(u'Employer'),
538        required = False,
539        readonly = False,
540        )
541    emp_position = schema.TextLine(
542        title = _(u'Employer Position'),
543        required = False,
544        readonly = False,
545        )
546    emp_start = FormattedDate(
547        title = _(u'Start Date'),
548        required = False,
549        readonly = False,
550        show_year = True,
551        )
552    emp_end = FormattedDate(
553        title = _(u'End Date'),
554        required = False,
555        readonly = False,
556        show_year = True,
557        )
558    emp_reason = schema.TextLine(
559        title = _(u'Reason for Leaving'),
560        required = False,
561        readonly = False,
562        )
563    employer2 = schema.TextLine(
564        title = _(u'2nd Employer'),
565        required = False,
566        readonly = False,
567        )
568    emp2_position = schema.TextLine(
569        title = _(u'2nd Employer Position'),
570        required = False,
571        readonly = False,
572        )
573    emp2_start = FormattedDate(
574        title = _(u'Start Date'),
575        required = False,
576        readonly = False,
577        show_year = True,
578        )
579    emp2_end = FormattedDate(
580        title = _(u'End Date'),
581        required = False,
582        readonly = False,
583        show_year = True,
584        )
585    emp2_reason = schema.TextLine(
586        title = _(u'Reason for Leaving'),
587        required = False,
588        readonly = False,
589        )
590    notice = schema.Text(
591        title = _(u'Notice'),
592        required = False,
593        readonly = False,
594        )
595    screening_venue = schema.TextLine(
596        title = _(u'Screening Venue'),
597        required = False,
598        )
599    screening_date = schema.TextLine(
600        title = _(u'Screening Date'),
601        required = False,
602        )
603    screening_score = schema.Int(
604        title = _(u'Screening Score (%)'),
605        required = False,
606        )
607    student_id = schema.TextLine(
608        title = _(u'Student Id'),
609        required = False,
610        readonly = False,
611        )
612    course_admitted = schema.Choice(
613        title = _(u'Admitted Course of Study'),
614        source = CertificateSource(),
615        required = False,
616        readonly = False,
617        )
618    locked = schema.Bool(
619        title = _(u'Form locked'),
620        default = False,
621        required = False,
622        )
623
624INigeriaPGApplicant[
625    'locked'].order =  IApplicantBaseData['suspended'].order
626
627# PRE is used by Uniben
628#  med: "it is as named... PRE - DEGREE... much like a 1 year diploma programme"
629PRE_OMIT_FIELDS = tuple([
630    i for i in getFields(INigeriaPGApplicant).keys()
631        if i[:3] in ('hq_', 'emp', 'nys')])
632PRE_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PRE_OMIT_FIELDS
633PRE_OMIT_MANAGE_FIELDS = PG_OMIT_MANAGE_FIELDS + PRE_OMIT_FIELDS
634PRE_OMIT_EDIT_FIELDS = set(PG_OMIT_EDIT_FIELDS + PRE_OMIT_FIELDS)
635PRE_OMIT_PDF_FIELDS = PRE_OMIT_DISPLAY_FIELDS
636PRE_OMIT_RESULT_SLIP_FIELDS = PRE_OMIT_DISPLAY_FIELDS
637
638class INigeriaApplicant(INigeriaUGApplicant, INigeriaPGApplicant):
639    """An interface for both types of applicants.
640
641    Attention: The INigeriaPGApplicant field seetings will be overwritten
642    by INigeriaPGApplicant field settings. If a field is defined
643    in both interfaces zope.schema validates only against the
644    constraints in INigeriaUGApplicant. This does not affect the forms
645    since they are build on either INigeriaUGApplicant or INigeriaPGApplicant.
646    """
647
648    def writeLogMessage(view, comment):
649        """Adds an INFO message to the log file
650        """
651
652    def createStudent():
653        """Create a student object from applicant data
654        and copy applicant object.
655        """
656
657class INigeriaUGApplicantEdit(INigeriaUGApplicant):
658    """An undergraduate applicant interface for edit forms.
659
660    Here we can repeat the fields from base data and set the
661    `required` and `readonly` attributes to True to further restrict
662    the data access. Or we can allow only certain certificates to be
663    selected by choosing the appropriate source.
664
665    We cannot omit fields here. This has to be done in the
666    respective form page.
667    """
668
669    email = schema.ASCIILine(
670        title = _(u'Email Address'),
671        required = True,
672        constraint=validate_email,
673        )
674    date_of_birth = FormattedDate(
675        title = _(u'Date of Birth'),
676        required = True,
677        show_year = True,
678        )
679    jamb_subjects_list = schema.List(
680        title = _(u'JAMB Subjects'),
681        description = _(u'Select four subjects.'),
682        required = True,
683        constraint = four_items,
684        value_type = schema.Choice(
685            vocabulary = jambsubjects
686            #source = JAMBSubjectSource(),
687            ),
688        )
689
690INigeriaUGApplicantEdit[
691    'date_of_birth'].order = INigeriaUGApplicant['date_of_birth'].order
692INigeriaUGApplicantEdit[
693    'email'].order = INigeriaUGApplicant['email'].order
694INigeriaUGApplicantEdit[
695    'jamb_subjects_list'].order = INigeriaUGApplicant['jamb_subjects_list'].order
696
697class INigeriaPGApplicantEdit(INigeriaPGApplicant):
698    """A postgraduate applicant interface for editing.
699
700    Here we can repeat the fields from base data and set the
701    `required` and `readonly` attributes to True to further restrict
702    the data access. Or we can allow only certain certificates to be
703    selected by choosing the appropriate source.
704
705    We cannot omit fields here. This has to be done in the
706    respective form page.
707    """
708
709    email = schema.ASCIILine(
710        title = _(u'Email Address'),
711        required = True,
712        constraint=validate_email,
713        )
714    date_of_birth = FormattedDate(
715        title = _(u'Date of Birth'),
716        required = True,
717        show_year = True,
718        )
719
720INigeriaPGApplicantEdit[
721    'date_of_birth'].order =  INigeriaPGApplicant['date_of_birth'].order
722INigeriaPGApplicantEdit[
723    'email'].order =  INigeriaPGApplicant['email'].order
724
725class INigeriaApplicantOnlinePayment(INigeriaOnlinePayment):
726    """An applicant payment via payment gateways.
727    """
728
729class IPUTMEApplicantEdit(INigeriaUGApplicant):
730    """An undergraduate applicant interface for editing.
731
732    Here we can repeat the fields from base data and set the
733    `required` and `readonly` attributes to True to further restrict
734    the data access. Or we can allow only certain certificates to be
735    selected by choosing the appropriate source.
736
737    We cannot omit fields here. This has to be done in the
738    respective form page.
739    """
740    email = schema.ASCIILine(
741        title = _(u'Email Address'),
742        required = True,
743        constraint=validate_email,
744        )
745    date_of_birth = FormattedDate(
746        title = _(u'Date of Birth'),
747        required = True,
748        show_year = True,
749        )
750    nationality = schema.Choice(
751        source = nats_vocab,
752        title = _(u'Nationality'),
753        required = True,
754        )
755
756IPUTMEApplicantEdit[
757    'date_of_birth'].order =  INigeriaUGApplicant['date_of_birth'].order
758IPUTMEApplicantEdit[
759    'email'].order =  INigeriaUGApplicant['email'].order
760IPUTMEApplicantEdit[
761    'nationality'].order =  INigeriaUGApplicant['nationality'].order
762
763class INigeriaApplicantUpdateByRegNo(INigeriaApplicant):
764    """Representation of an applicant.
765
766    Skip regular reg_number validation if reg_number is used for finding
767    the applicant object.
768    """
769    reg_number = schema.TextLine(
770        title = u'Registration Number',
771        required = False,
772        )
Note: See TracBrowser for help on using the repository browser.