Changeset 9049


Ignore:
Timestamp:
25 Jul 2012, 21:57:47 (12 years ago)
Author:
Henrik Bettermann
Message:

Add hq fields to the ug interface and reorganize OMIT tuples.

Location:
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/browser.py

    r8926 r9049  
    3838    INigeriaPGApplicant, INigeriaUGApplicant,
    3939    INigeriaPGApplicantEdit, INigeriaUGApplicantEdit,
    40     INigeriaApplicantOnlinePayment, IPUTMEApplicantEdit,
    41     UG_OMIT_DISPLAY_FIELDS, PG_OMIT_DISPLAY_FIELDS,
    42     UG_OMIT_PDF_FIELDS, PG_OMIT_PDF_FIELDS,
    43     UG_OMIT_MANAGE_FIELDS, PG_OMIT_MANAGE_FIELDS,
     40    INigeriaApplicantOnlinePayment,IPUTMEApplicantEdit,
     41    UG_OMIT_DISPLAY_FIELDS, PUTME_OMIT_DISPLAY_FIELDS, PG_OMIT_DISPLAY_FIELDS,
     42    UG_OMIT_PDF_FIELDS, PUTME_OMIT_PDF_FIELDS, PG_OMIT_PDF_FIELDS,
     43    UG_OMIT_MANAGE_FIELDS, PUTME_OMIT_MANAGE_FIELDS, PG_OMIT_MANAGE_FIELDS,
    4444    UG_OMIT_EDIT_FIELDS, PG_OMIT_EDIT_FIELDS, PUTME_OMIT_EDIT_FIELDS,
    45     UG_OMIT_RESULT_SLIP_FIELDS)
     45    PUTME_OMIT_RESULT_SLIP_FIELDS)
    4646from kofacustom.nigeria.interfaces import MessageFactory as _
    4747
     
    8585            for field in PG_OMIT_PDF_FIELDS:
    8686                form_fields = form_fields.omit(field)
     87        elif target is not None and target.startswith('putme'):
     88            form_fields = grok.AutoFields(INigeriaUGApplicant)
     89            if self._reduced_slip():
     90                for field in PUTME_OMIT_RESULT_SLIP_FIELDS:
     91                    form_fields = form_fields.omit(field)
     92            else:
     93                for field in PUTME_OMIT_PDF_FIELDS:
     94                    form_fields = form_fields.omit(field)
    8795        else:
    8896            form_fields = grok.AutoFields(INigeriaUGApplicant)
    89             if self._reduced_slip():
    90                 for field in UG_OMIT_RESULT_SLIP_FIELDS:
    91                     form_fields = form_fields.omit(field)
    92             else:
    93                 for field in UG_OMIT_PDF_FIELDS:
    94                     form_fields = form_fields.omit(field)
     97            for field in UG_OMIT_PDF_FIELDS:
     98                form_fields = form_fields.omit(field)
    9599        if not getattr(self.context, 'student_id'):
    96100            form_fields = form_fields.omit('student_id')
     
    107111            form_fields = grok.AutoFields(INigeriaPGApplicant)
    108112            for field in PG_OMIT_DISPLAY_FIELDS:
     113                form_fields = form_fields.omit(field)
     114        elif target is not None and target.startswith('putme'):
     115            form_fields = grok.AutoFields(INigeriaUGApplicant)
     116            for field in PUTME_OMIT_DISPLAY_FIELDS:
    109117                form_fields = form_fields.omit(field)
    110118        else:
     
    124132            form_fields = grok.AutoFields(INigeriaPGApplicant)
    125133            for field in PG_OMIT_MANAGE_FIELDS:
     134                form_fields = form_fields.omit(field)
     135        elif target is not None and target.startswith('putme'):
     136            form_fields = grok.AutoFields(INigeriaUGApplicant)
     137            for field in PUTME_OMIT_MANAGE_FIELDS:
    126138                form_fields = form_fields.omit(field)
    127139        else:
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/interfaces.py

    r9045 r9049  
    2121from zope import schema
    2222from waeup.kofa.applicants.interfaces import (
     23    contextual_reg_num_source,
    2324    IApplicantBaseData,
    2425    AppCatCertificateSource, CertificateSource)
     
    2829from waeup.kofa.schema import FormattedDate, TextLineChoice
    2930from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
    30 from waeup.kofa.applicants.interfaces import contextual_reg_num_source
    3131from kofacustom.nigeria.interfaces import (
    3232    LGASource, high_qual, high_grade, exam_types)
     
    3434from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment
    3535
    36 UG_OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted',
    37     'password', 'result_uploaded', 'suspended')
     36# Fields to be omitted in all display forms. course_admitted is
     37# rendered seperately.
     38
     39OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted',
     40    'result_uploaded', 'suspended')
     41
     42# UG students are all undergraduate students.
     43UG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS
    3844UG_OMIT_PDF_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('email', 'phone')
    3945UG_OMIT_MANAGE_FIELDS = ()
    40 UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + ('locked', 'course_admitted',
    41     'student_id', 'screening_score', 'screening_venue', 'notice',
    42     'screening_date', 'result_uploaded', 'suspended',
    43     'jamb_subjects', 'jamb_score', 'aggregate')
    44 PUTME_OMIT_EDIT_FIELDS = UG_OMIT_EDIT_FIELDS + (
     46UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + (
     47    'student_id', 'notice',
     48    'screening_score', 'screening_venue',
     49    'screening_date', 'jamb_subjects',
     50    'jamb_score', 'aggregate')
     51
     52# PUTME is a subgroup of UG with the same interface.
     53PUTME_OMIT_FIELDS = (
     54    'hq_type', 'hq_matric_no',
     55    'hq_degree', 'hq_school',
     56    'hq_session', 'hq_disc',)
     57PUTME_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUTME_OMIT_FIELDS
     58PUTME_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUTME_OMIT_FIELDS
     59PUTME_OMIT_EDIT_FIELDS = UG_OMIT_EDIT_FIELDS + PUTME_OMIT_FIELDS + (
    4560    'firstname', 'middlename', 'lastname', 'sex',
    4661    'course1', 'lga')
    47 UG_OMIT_RESULT_SLIP_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('email', 'phone',
     62PUTME_OMIT_PDF_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + ('email', 'phone')
     63PUTME_OMIT_RESULT_SLIP_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + (
     64    'email', 'phone',
    4865    'date_of_birth', 'sex',
    49     'nationality', 'lga', 'perm_address', 'course2', 'screening_venue',
     66    'nationality', 'lga', 'perm_address',
     67    'course2', 'screening_venue',
    5068    'screening_date')
    5169
    52 PG_OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted', 'password', 'suspended')
    53 PG_OMIT_PDF_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('email', 'phone')
     70# PG has its own interface
     71PG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS
     72PG_OMIT_PDF_FIELDS = PG_OMIT_DISPLAY_FIELDS + ('email', 'phone')
    5473PG_OMIT_MANAGE_FIELDS = ()
    5574PG_OMIT_EDIT_FIELDS = PG_OMIT_MANAGE_FIELDS + (
    56     'locked', 'course_admitted', 'suspended',
    57     'student_id', 'screening_score', 'screening_venue', 'notice',
    58     'screening_date')
     75    'student_id', 'notice')
    5976
    6077class INigeriaUGApplicant(IApplicantBaseData):
     
    90107        required = False,
    91108        )
     109    hq_type = schema.Choice(
     110        title = _(u'Qualification Obtained'),
     111        required = False,
     112        readonly = False,
     113        vocabulary = high_qual,
     114        )
     115    hq_matric_no = schema.TextLine(
     116        title = _(u'Former Matric Number'),
     117        required = False,
     118        readonly = False,
     119        )
     120    hq_degree = schema.Choice(
     121        title = _(u'Class of Degree'),
     122        required = False,
     123        readonly = False,
     124        vocabulary = high_grade,
     125        )
     126    hq_school = schema.TextLine(
     127        title = _(u'Institution Attended'),
     128        required = False,
     129        readonly = False,
     130        )
     131    hq_session = schema.TextLine(
     132        title = _(u'Years Attended'),
     133        required = False,
     134        readonly = False,
     135        )
     136    hq_disc = schema.TextLine(
     137        title = _(u'Discipline'),
     138        required = False,
     139        readonly = False,
     140        )
    92141    jamb_subjects = schema.Text(
    93142        title = _(u'Subjects and Scores'),
     
    208257        vocabulary = exam_types,
    209258        )
    210     #presently = schema.Bool(
    211     #    title = _(u'Attending'),
    212     #    required = False,
    213     #    readonly = False,
    214     #    )
    215259    presently_inst = schema.TextLine(
    216260        title = _(u'If yes, name of institution'),
Note: See TracChangeset for help on using the changeset viewer.