Changeset 9054


Ignore:
Timestamp:
26 Jul 2012, 06:23:18 (12 years ago)
Author:
Henrik Bettermann
Message:

Add PUDE '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

    r9050 r9054  
    2222from zope.i18n import translate
    2323from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
     24from zope.formlib.textwidgets import BytesDisplayWidget
    2425from waeup.kofa.students.interfaces import IStudentsUtils
    2526from waeup.kofa.applicants.interfaces import (
     
    3940    INigeriaPGApplicantEdit, INigeriaUGApplicantEdit,
    4041    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,
    44     UG_OMIT_EDIT_FIELDS, PG_OMIT_EDIT_FIELDS, PUTME_OMIT_EDIT_FIELDS,
    45     PUTME_OMIT_RESULT_SLIP_FIELDS)
     42    UG_OMIT_DISPLAY_FIELDS,
     43    UG_OMIT_PDF_FIELDS,
     44    UG_OMIT_MANAGE_FIELDS,
     45    UG_OMIT_EDIT_FIELDS,
     46    PG_OMIT_DISPLAY_FIELDS,
     47    PG_OMIT_PDF_FIELDS,
     48    PG_OMIT_MANAGE_FIELDS,
     49    PG_OMIT_EDIT_FIELDS,
     50    PUTME_OMIT_DISPLAY_FIELDS,
     51    PUTME_OMIT_PDF_FIELDS,
     52    PUTME_OMIT_MANAGE_FIELDS,
     53    PUTME_OMIT_EDIT_FIELDS,
     54    PUTME_OMIT_RESULT_SLIP_FIELDS,
     55    PUDE_OMIT_DISPLAY_FIELDS,
     56    PUDE_OMIT_PDF_FIELDS,
     57    PUDE_OMIT_MANAGE_FIELDS,
     58    PUDE_OMIT_EDIT_FIELDS,
     59    PUDE_OMIT_RESULT_SLIP_FIELDS,
     60    )
    4661from kofacustom.nigeria.interfaces import MessageFactory as _
    4762
     
    7893            for field in PUTME_OMIT_DISPLAY_FIELDS:
    7994                form_fields = form_fields.omit(field)
     95        elif target is not None and target.startswith('pude'):
     96            form_fields = grok.AutoFields(INigeriaUGApplicant)
     97            for field in PUDE_OMIT_DISPLAY_FIELDS:
     98                form_fields = form_fields.omit(field)
    8099        else:
    81100            form_fields = grok.AutoFields(INigeriaUGApplicant)
    82101            for field in UG_OMIT_DISPLAY_FIELDS:
    83102                form_fields = form_fields.omit(field)
     103        form_fields['perm_address'].custom_widget = BytesDisplayWidget
     104        form_fields['notice'].custom_widget = BytesDisplayWidget
    84105        return form_fields
    85106
     
    113134                for field in PUTME_OMIT_PDF_FIELDS:
    114135                    form_fields = form_fields.omit(field)
     136        elif target is not None and target.startswith('pude'):
     137            form_fields = grok.AutoFields(INigeriaUGApplicant)
     138            if self._reduced_slip():
     139                for field in PUDE_OMIT_RESULT_SLIP_FIELDS:
     140                    form_fields = form_fields.omit(field)
     141            else:
     142                for field in PUDE_OMIT_PDF_FIELDS:
     143                    form_fields = form_fields.omit(field)
    115144        else:
    116145            form_fields = grok.AutoFields(INigeriaUGApplicant)
     
    136165            for field in PUTME_OMIT_MANAGE_FIELDS:
    137166                form_fields = form_fields.omit(field)
     167        elif target is not None and target.startswith('pude'):
     168            form_fields = grok.AutoFields(INigeriaUGApplicant)
     169            for field in PUDE_OMIT_MANAGE_FIELDS:
     170                form_fields = form_fields.omit(field)
    138171        else:
    139172            form_fields = grok.AutoFields(INigeriaUGApplicant)
     
    158191            form_fields = grok.AutoFields(IPUTMEApplicantEdit)
    159192            for field in PUTME_OMIT_EDIT_FIELDS:
     193                form_fields = form_fields.omit(field)
     194        elif target is not None and target.startswith('pude'):
     195            form_fields = grok.AutoFields(INigeriaUGApplicant)
     196            for field in PUDE_OMIT_EDIT_FIELDS:
    160197                form_fields = form_fields.omit(field)
    161198        else:
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/interfaces.py

    r9049 r9054  
    6868    'screening_date')
    6969
     70# PUDE is a subgroup of UG with the same interface.
     71PUDE_OMIT_FIELDS = (
     72    'jamb_subjects','jamb_score', 'aggregate')
     73PUDE_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUDE_OMIT_FIELDS
     74PUDE_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUDE_OMIT_FIELDS
     75PUDE_OMIT_EDIT_FIELDS = set(UG_OMIT_EDIT_FIELDS + PUDE_OMIT_FIELDS + (
     76    'firstname', 'middlename', 'lastname', 'sex',
     77    'course1', 'lga'))
     78PUDE_OMIT_PDF_FIELDS = PUDE_OMIT_DISPLAY_FIELDS + ('email', 'phone')
     79PUDE_OMIT_RESULT_SLIP_FIELDS = PUDE_OMIT_DISPLAY_FIELDS + (
     80    'email', 'phone',
     81    'date_of_birth', 'sex',
     82    'nationality', 'lga', 'perm_address',
     83    'course2', 'screening_venue',
     84    'screening_date')
     85
    7086# PG has its own interface
    7187PG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS
Note: See TracChangeset for help on using the changeset viewer.