Ignore:
Timestamp:
3 Jul 2020, 07:11:31 (4 years ago)
Author:
Henrik Bettermann
Message:

Implement transcript application.

File:
1 edited

Legend:

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

    r16077 r16142  
    5454    ICustomPGApplicant, ICustomUGApplicant, ICustomApplicant,
    5555    ICustomPGApplicantEdit, ICustomUGApplicantEdit,
    56     ICustomApplicantOnlinePayment, ICustomApplicantRefereeReport
     56    ICustomApplicantOnlinePayment, ICustomApplicantRefereeReport,
     57    ITranscriptApplicant
    5758    )
    5859from kofacustom.iuokada.interfaces import MessageFactory as _
     
    120121    'screening_date',)
    121122
     123TRANS_OMIT_FIELDS = ('locked', 'suspended', 'applicant_id',)
     124
     125TRANS_SHORT_OMIT_FIELDS = TRANS_OMIT_FIELDS + (
     126    'date_of_birth',
     127    'sex',
     128    'nationality',
     129    'entry_mode',
     130    'entry_session',
     131    'end_session',
     132    'course_studied',
     133    'course_changed',
     134    'change_level',
     135    )
     136
    122137class CustomApplicantsContainerPage(ApplicantsContainerPage):
    123138    """The standard view for regular applicant containers.
     
    143158    @property
    144159    def form_fields(self):
     160        if self.target is not None and self.target == 'transfull':
     161            form_fields = grok.AutoFields(ITranscriptApplicant)
     162            for field in TRANS_OMIT_FIELDS:
     163                form_fields = form_fields.omit(field)
     164            form_fields['dispatch_address'].custom_widget = BytesDisplayWidget
     165            form_fields['perm_address'].custom_widget = BytesDisplayWidget
     166            return form_fields
     167        if self.target is not None and self.target == 'transshort':
     168            form_fields = grok.AutoFields(ITranscriptApplicant)
     169            for field in TRANS_SHORT_OMIT_FIELDS:
     170                form_fields = form_fields.omit(field)
     171            form_fields['dispatch_address'].custom_widget = BytesDisplayWidget
     172            form_fields['perm_address'].custom_widget = BytesDisplayWidget
     173            return form_fields
    145174        if self.target is not None and self.target.startswith('pg'):
    146175            form_fields = grok.AutoFields(ICustomPGApplicant)
     
    207236    @property
    208237    def form_fields(self):
     238        if self.target is not None and self.target == 'transfull':
     239            form_fields = grok.AutoFields(ITranscriptApplicant)
     240            for field in TRANS_OMIT_FIELDS:
     241                form_fields = form_fields.omit(field)
     242            return form_fields
     243        if self.target is not None and self.target == 'transshort':
     244            form_fields = grok.AutoFields(ITranscriptApplicant)
     245            for field in TRANS_SHORT_OMIT_FIELDS:
     246                form_fields = form_fields.omit(field)
     247            return form_fields
    209248        if self.target is not None and self.target.startswith('pg'):
    210249            form_fields = grok.AutoFields(ICustomPGApplicant)
     
    281320    @property
    282321    def form_fields(self):
     322        if self.target is not None and self.target == 'transfull':
     323            form_fields = grok.AutoFields(ITranscriptApplicant)
     324            for field in TRANS_OMIT_FIELDS:
     325                form_fields = form_fields.omit(field)
     326            return form_fields
     327        if self.target is not None and self.target == 'transshort':
     328            form_fields = grok.AutoFields(ITranscriptApplicant)
     329            for field in TRANS_SHORT_OMIT_FIELDS:
     330                form_fields = form_fields.omit(field)
     331            return form_fields
    283332        if self.target is not None and self.target.startswith('pg'):
    284333            form_fields = grok.AutoFields(ICustomPGApplicantEdit)
Note: See TracChangeset for help on using the changeset viewer.