Ignore:
Timestamp:
31 Jan 2022, 09:14:15 (3 years ago)
Author:
Henrik Bettermann
Message:

Implement new pg application form.

File:
1 edited

Legend:

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

    r16548 r16763  
    5151from waeup.aaue.applicants.interfaces import (
    5252    ICustomUGApplicant,
     53    ICustomPGApplicant,
    5354    ICustomUGApplicantEdit,
     55    ICustomPGApplicantEdit,
    5456    ITranscriptApplicant,
    5557    ICertificateRequest,
     
    155157
    156158PG_OMIT_FIELDS = (
    157     'fst_sit_fname',
    158     'fst_sit_no',
    159     'fst_sit_date',
    160     'fst_sit_type',
    161     'fst_sit_results',
    162     'scd_sit_fname',
    163     'scd_sit_no',
    164     'scd_sit_date',
    165     'scd_sit_type',
    166     'scd_sit_results',
    167     #'programme_type',
    168     'jamb_age',
    169     'jamb_subjects',
    170     'jamb_score',
    171     'jamb_reg_number',
    172     'aggregate'
     159
    173160    )
    174161PG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + (
    175     'jamb_subjects_list',) + PG_OMIT_FIELDS
     162    ) + PG_OMIT_FIELDS
    176163PG_OMIT_PDF_FIELDS = PG_OMIT_DISPLAY_FIELDS + PG_OMIT_FIELDS + (
    177       'reg_number','alr_fname', 'alr_no', 'alr_date',
    178       'alr_results', 'notice',
    179       'nysc_year',
    180       'nysc_location',
    181       'nysc_lga',
    182       'former_matric',
    183164      )
    184165PG_OMIT_MANAGE_FIELDS = (
    185     'special_application','jamb_subjects_list',) + PG_OMIT_FIELDS
     166    ) + PG_OMIT_FIELDS
    186167PG_OMIT_EDIT_FIELDS = PG_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + (
    187     'student_id',
    188     'notice',
    189168    )
    190169
     
    269248            form_fields = grok.AutoFields(ICertificateRequest).omit(
    270249                'locked', 'suspended')
    271             #form_fields['dispatch_address'].custom_widget = BytesDisplayWidget
    272             #form_fields['perm_address'].custom_widget = BytesDisplayWidget
    273             return form_fields
    274         # AAUE is using the same interface for all regular applications.
    275         form_fields = grok.AutoFields(ICustomUGApplicant)
    276         if self.target is not None and self.target.startswith('pg'):
     250            return form_fields
     251        if self.target is not None and self.target in ('ptee','dsh',):
     252            form_fields = grok.AutoFields(ICustomUGApplicant)
     253            for field in PTEE_OMIT_DISPLAY_FIELDS:
     254                form_fields = form_fields.omit(field)
     255        elif self.target is not None and self.target in ('bridge', 'ude',):
     256            form_fields = grok.AutoFields(ICustomUGApplicant)
     257            for field in UDE_OMIT_DISPLAY_FIELDS:
     258                form_fields = form_fields.omit(field)
     259        elif self.target is not None and self.target.startswith('pg'):
     260            form_fields = grok.AutoFields(ICustomPGApplicant)
    277261            for field in PG_OMIT_DISPLAY_FIELDS:
    278262                form_fields = form_fields.omit(field)
    279         elif self.target is not None and self.target in ('ptee','dsh',):
    280             for field in PTEE_OMIT_DISPLAY_FIELDS:
    281                 form_fields = form_fields.omit(field)
    282         elif self.target is not None and self.target in ('bridge', 'ude',):
    283             for field in UDE_OMIT_DISPLAY_FIELDS:
    284                 form_fields = form_fields.omit(field)
    285263        else:
     264            form_fields = grok.AutoFields(ICustomUGApplicant)
    286265            for field in UG_OMIT_DISPLAY_FIELDS:
    287266                form_fields = form_fields.omit(field)
    288         form_fields['perm_address'].custom_widget = BytesDisplayWidget
    289         form_fields['notice'].custom_widget = BytesDisplayWidget
    290267        if not getattr(self.context, 'student_id'):
    291268            form_fields = form_fields.omit('student_id')
     
    367344        if self.target is not None and self.target.startswith('pg'):
    368345            for field in PG_OMIT_PDF_FIELDS:
     346                form_fields = grok.AutoFields(ICustomPGApplicant)
    369347                form_fields = form_fields.omit(field)
    370348        elif self.target is not None and self.target in ('ptee', 'dsh',):
     
    400378        if not getattr(self.context, 'screening_date'):
    401379            form_fields = form_fields.omit('screening_date')
     380        hqfields = ('hq_type', 'hq_fname', 'hq_matric_no',
     381                    'hq_degree', 'hq_school', 'hq_session', 'hq_disc')
     382        if not getattr(self.context, 'hq_type'):
     383            for hq in hqfields:
     384                form_fields = form_fields.omit(hq)
     385        if not getattr(self.context, 'hq_type2'):
     386            for hq in hqfields:
     387                form_fields = form_fields.omit(hq + '2')
     388        if not getattr(self.context, 'hq_type3'):
     389            for hq in hqfields:
     390                form_fields = form_fields.omit(hq + '3')
     391        if not getattr(self.context, 'hq_type4'):
     392            for hq in hqfields:
     393                form_fields = form_fields.omit(hq + '4')
    402394        return form_fields
    403395
     
    444436        form_fields = grok.AutoFields(ICustomUGApplicant)
    445437        if self.target is not None and self.target.startswith('pg'):
     438            form_fields = grok.AutoFields(ICustomPGApplicant)
    446439            for field in PG_OMIT_MANAGE_FIELDS:
    447440                form_fields = form_fields.omit(field)
     
    579572        form_fields = grok.AutoFields(ICustomUGApplicantEdit)
    580573        if self.target is not None and self.target.startswith('pg'):
     574            form_fields = grok.AutoFields(ICustomPGApplicantEdit)
    581575            for field in PG_OMIT_EDIT_FIELDS:
    582576                form_fields = form_fields.omit(field)
Note: See TracChangeset for help on using the changeset viewer.