Ignore:
Timestamp:
15 Aug 2023, 09:47:00 (15 months ago)
Author:
Henrik Bettermann
Message:

PT students have different fields and must fill JAMB reg number.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py

    r17537 r17538  
    5858from kofacustom.nigeria.applicants.interfaces import (
    5959    OMIT_DISPLAY_FIELDS,
    60 #    UG_OMIT_DISPLAY_FIELDS,
    61 #    UG_OMIT_PDF_FIELDS,
    62 #    UG_OMIT_MANAGE_FIELDS,
    63 #    UG_OMIT_EDIT_FIELDS,
     60    UG_OMIT_DISPLAY_FIELDS,
     61    UG_OMIT_PDF_FIELDS,
     62    UG_OMIT_MANAGE_FIELDS,
     63    UG_OMIT_EDIT_FIELDS,
    6464    CBT_OMIT_DISPLAY_FIELDS,
    6565    CBT_OMIT_PDF_FIELDS,
     
    7575    PG_OMIT_EDIT_FIELDS,
    7676    PUTME_OMIT_DISPLAY_FIELDS,
    77 #    PUTME_OMIT_PDF_FIELDS,
    78 #    PUTME_OMIT_MANAGE_FIELDS,
    79 #    PUTME_OMIT_EDIT_FIELDS,
    80 #    PUTME_OMIT_RESULT_SLIP_FIELDS,
     77    PUTME_OMIT_PDF_FIELDS,
     78    PUTME_OMIT_MANAGE_FIELDS,
     79    PUTME_OMIT_EDIT_FIELDS,
     80    PUTME_OMIT_RESULT_SLIP_FIELDS,
    8181    PUDE_OMIT_DISPLAY_FIELDS,
    8282    PUDE_OMIT_PDF_FIELDS,
     
    109109             'ACT','ENT','HRM','INS','MKT'] + PASTQ_ALL
    110110
    111 # UG students are all undergraduate students. Meanwhile
    112 # Uniben uses a customized version.
    113 
    114 UG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + (
    115     'jamb_subjects_list', 'programme_type')
    116 UG_OMIT_PDF_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('phone',)
    117 UG_OMIT_MANAGE_FIELDS = (
    118     'special_application',
    119     'jamb_subjects_list',
    120     'programme_type')
    121 UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + (
     111PT_OMIT_FIELDS = (
    122112    'student_id',
    123113    'notice',
     
    128118    'jamb_subjects',
    129119    'jamb_score',
    130 #    'jamb_reg_number',
    131     'aggregate')
    132 
    133 # PUTME is a subgroup of UG with the same interface. Meanwhile
    134 # Uniben uses a customized version.
    135 
    136 PUTME_OMIT_FIELDS = (
     120    #'jamb_reg_number',
     121    'aggregate',
    137122    'hq_type', 'hq_matric_no',
    138123    'hq_degree', 'hq_school',
     
    140125    'jamb_subjects_list', 'programme_type')
    141126
    142 PUTME_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUTME_OMIT_FIELDS
    143 
    144 PUTME_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUTME_OMIT_FIELDS
    145 
    146 PUTME_OMIT_EDIT_FIELDS = UG_OMIT_EDIT_FIELDS + PUTME_OMIT_FIELDS
    147 
    148 PUTME_OMIT_PDF_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + ('phone',)
    149 PUTME_OMIT_RESULT_SLIP_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + (
     127PT_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PT_OMIT_FIELDS
     128
     129PT_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PT_OMIT_FIELDS
     130
     131PT_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + PT_OMIT_FIELDS
     132
     133PT_OMIT_PDF_FIELDS = PT_OMIT_DISPLAY_FIELDS + ('phone',)
     134PT_OMIT_RESULT_SLIP_FIELDS = PT_OMIT_DISPLAY_FIELDS + (
    150135    'phone',
    151136    'date_of_birth', 'sex',
     
    342327            for field in PUTME_OMIT_DISPLAY_FIELDS:
    343328                form_fields = form_fields.omit(field)
     329        elif self.target is not None and self.target.startswith('pt'):
     330            form_fields = grok.AutoFields(ICustomUGApplicant)
     331            for field in PT_OMIT_DISPLAY_FIELDS:
     332                form_fields = form_fields.omit(field)
    344333        elif self.target is not None and self.target.startswith('pude'):
    345334            form_fields = grok.AutoFields(ICustomUGApplicant)
     
    351340                form_fields = form_fields.omit(field)
    352341        #form_fields['perm_address'].custom_widget = BytesDisplayWidget
    353         form_fields['notice'].custom_widget = BytesDisplayWidget
     342        try:
     343            form_fields['notice'].custom_widget = BytesDisplayWidget
     344        except:
     345            pass
    354346        if not getattr(self.context, 'student_id'):
    355347            form_fields = form_fields.omit('student_id')
     
    537529            for field in PUTME_OMIT_MANAGE_FIELDS:
    538530                form_fields = form_fields.omit(field)
     531        elif self.target is not None and self.target.startswith('pt'):
     532            form_fields = grok.AutoFields(ICustomUGApplicant)
     533            for field in PT_OMIT_MANAGE_FIELDS:
     534                form_fields = form_fields.omit(field)
    539535        elif self.target is not None and self.target.startswith('pude'):
    540536            form_fields = grok.AutoFields(ICustomUGApplicant)
     
    545541            for field in UG_OMIT_MANAGE_FIELDS:
    546542                form_fields = form_fields.omit(field)
    547         form_fields['student_id'].for_display = True
    548         form_fields['applicant_id'].for_display = True
     543        try:
     544            form_fields['student_id'].for_display = True
     545        except:
     546            pass
     547        try:
     548            form_fields['applicant_id'].for_display = True
     549        except:
     550            pass
    549551        return form_fields
    550552
     
    621623            form_fields = grok.AutoFields(IPUTMEApplicantEdit)
    622624            for field in PUTME_OMIT_EDIT_FIELDS:
     625                form_fields = form_fields.omit(field)
     626        elif self.target is not None and self.target.startswith('pt'):
     627            form_fields = grok.AutoFields(IPUTMEApplicantEdit)
     628            for field in PT_OMIT_EDIT_FIELDS:
    623629                form_fields = form_fields.omit(field)
    624630        elif self.target is not None and self.target.startswith('pude'):
     
    766772            else:
    767773                for field in PUTME_OMIT_PDF_FIELDS:
     774                    form_fields = form_fields.omit(field)
     775        elif self.target is not None and self.target.startswith('pt'):
     776            form_fields = grok.AutoFields(ICustomUGApplicant)
     777            if self._reduced_slip():
     778                for field in PT_OMIT_RESULT_SLIP_FIELDS:
     779                    form_fields = form_fields.omit(field)
     780            else:
     781                for field in PT_OMIT_PDF_FIELDS:
    768782                    form_fields = form_fields.omit(field)
    769783        elif self.target is not None and self.target.startswith('pude'):
Note: See TracChangeset for help on using the changeset viewer.