Ignore:
Timestamp:
6 Jul 2022, 11:38:52 (2 years ago)
Author:
Henrik Bettermann
Message:

Configure registration form.

File:
1 edited

Legend:

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

    r16983 r16997  
    1919"""
    2020import grok
     21from zope.formlib.textwidgets import BytesDisplayWidget
     22from waeup.kofa.applicants.pdf import PDFApplicationSlip
    2123from waeup.kofa.applicants.browser import (
    22     ApplicantRegistrationPage, ApplicantsContainerPage)
    23 from kofacustom.nigeria.applicants.browser import (
    24     NigeriaApplicantDisplayFormPage,
    25     NigeriaApplicantManageFormPage,
    26     NigeriaApplicantEditFormPage,
    27     NigeriaPDFApplicationSlip)
     24    ApplicantRegistrationPage, ApplicantsContainerPage,
     25    ApplicantDisplayFormPage,
     26    ApplicantManageFormPage,
     27    ApplicantEditFormPage)
    2828
    29 from kofacustom.nigeria.applicants.interfaces import (
    30     INigeriaPGApplicant, INigeriaUGApplicant,
    31     INigeriaPGApplicantEdit, INigeriaUGApplicantEdit,
    32     INigeriaApplicantOnlinePayment,
    33     UG_OMIT_DISPLAY_FIELDS,
    34     UG_OMIT_PDF_FIELDS,
    35     UG_OMIT_MANAGE_FIELDS,
    36     UG_OMIT_EDIT_FIELDS,
    37     PG_OMIT_DISPLAY_FIELDS,
    38     PG_OMIT_PDF_FIELDS,
    39     PG_OMIT_MANAGE_FIELDS,
    40     PG_OMIT_EDIT_FIELDS,
    41     )
    4229from kofacustom.lpng.applicants.interfaces import (
    43     ICustomPGApplicant, ICustomUGApplicant, ICustomApplicant,
    44     ICustomPGApplicantEdit, ICustomUGApplicantEdit,
     30    ICustomApplicant,
    4531    ICustomApplicantOnlinePayment,
    4632    )
     
    4834from kofacustom.lpng.interfaces import MessageFactory as _
    4935
    50 class CustomApplicantEditFormPage(NigeriaApplicantEditFormPage):
     36       
     37class CustomApplicantDisplayFormPage(ApplicantDisplayFormPage):
     38    """A display view for applicant data.
     39    """
     40
     41    @property
     42    def form_fields(self):
     43        form_fields = grok.AutoFields(ICustomApplicant)
     44        form_fields['perm_address'].custom_widget = BytesDisplayWidget
     45        form_fields['notice'].custom_widget = BytesDisplayWidget
     46        if not getattr(self.context, 'student_id'):
     47            form_fields = form_fields.omit('student_id')
     48        return form_fields
     49
     50class CustomPDFApplicationSlip(PDFApplicationSlip):
     51
     52    @property
     53    def form_fields(self):
     54        form_fields = grok.AutoFields(ICustomApplicant)
     55        if not getattr(self.context, 'student_id'):
     56            form_fields = form_fields.omit('student_id')
     57        return form_fields
     58
     59class CustomApplicantManageFormPage(ApplicantManageFormPage):
     60    """A full edit view for applicant data.
     61    """
     62
     63    @property
     64    def form_fields(self):
     65        form_fields = grok.AutoFields(ICustomApplicant)
     66        if not getattr(self.context, 'student_id'):
     67            form_fields = form_fields.omit('student_id')
     68        form_fields['applicant_id'].for_display = True
     69        return form_fields
     70
     71class CustomApplicantEditFormPage(ApplicantEditFormPage):
    5172    """An applicant-centered edit view for applicant data.
    5273    """
     
    5576        return True
    5677
     78    @property
     79    def form_fields(self):
     80        form_fields = grok.AutoFields(ICustomApplicant)
     81        form_fields = form_fields.omit('notice')
     82        if not getattr(self.context, 'student_id'):
     83            form_fields = form_fields.omit('student_id')
     84        form_fields['applicant_id'].for_display = True
     85        form_fields['reg_number'].for_display = True
     86        return form_fields
     87
Note: See TracChangeset for help on using the changeset viewer.