Ignore:
Timestamp:
4 Jun 2016, 18:31:00 (8 years ago)
Author:
Henrik Bettermann
Message:

Add components for TPU registration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/interfaces.py

    r13238 r13877  
    2020
    2121from zope import schema
     22from zc.sourcefactory.basic import BasicSourceFactory
    2223from waeup.kofa.applicants.interfaces import (
    2324    IApplicantBaseData,
     
    2526from waeup.kofa.schoolgrades import ResultEntryField
    2627from 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)
     30from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber
    2931from waeup.kofa.schoolgrades import ResultEntryField
    3032from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
     
    3941    OMIT_DISPLAY_FIELDS
    4042    )
     43from waeup.fceokene.applicants.schools import SCHOOLS
    4144from waeup.fceokene.interfaces import MessageFactory as _
    4245
     
    5356    'aggregate')
    5457
     58class 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
     72class 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
    55169class ICustomUGApplicant(INigeriaUGApplicant):
    56170    """An undergraduate applicant.
     
    237351    """
    238352
    239 class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
    240     """An interface for both types of applicants.
     353class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant,
     354    ITPURegistration):
     355    """An interface for all types of applicants.
    241356
    242357    Attention: The ICustomPGApplicant field seetings will be overwritten
Note: See TracChangeset for help on using the changeset viewer.