Changeset 8090


Ignore:
Timestamp:
10 Apr 2012, 09:17:02 (12 years ago)
Author:
Henrik Bettermann
Message:

Use customized PhoneWidget? in all application forms.

File:
1 edited

Legend:

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

    r8080 r8090  
    2323    FriendlyDatetimeDisplayWidget)
    2424from waeup.uniben.widgets.phonewidget import PhoneWidget
     25from waeup.kofa.applicants.interfaces import (
     26    IApplicantRegisterUpdate, IApplicant, IApplicantEdit)
    2527from waeup.kofa.applicants.browser import (ApplicantDisplayFormPage,
    2628    OnlinePaymentCallbackPage, ExportPDFPage,
    27     ApplicantManageFormPage, ApplicantEditFormPage)
     29    ApplicantManageFormPage, ApplicantEditFormPage,
     30    ApplicantRegistrationPage, ApplicantAddFormPage)
    2831from waeup.kofa.applicants.viewlets import RequestCallbackActionButton
    2932from waeup.kofa.applicants.pdf import PDFApplicationSlip
     
    5962            'date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le')
    6063        return form_fields
     64
     65class ApplicantAddFormPage(ApplicantAddFormPage):
     66    """Add-form to add an applicant.
     67    """
     68    form_fields = grok.AutoFields(IApplicant).select(
     69        'firstname', 'middlename', 'lastname',
     70        'email', 'phone')
     71    form_fields['phone'].custom_widget = PhoneWidget
    6172
    6273class ApplicantDisplayFormPage(ApplicantDisplayFormPage):
     
    134145        form_fields['reg_number'].for_display = True
    135146        return form_fields
     147
     148class ApplicantRegistrationPage(ApplicantRegistrationPage):
     149    """Captcha'd registration page for applicants.
     150    """
     151
     152    @property
     153    def form_fields(self):
     154        form_fields = None
     155        if self.context.mode == 'create':
     156            form_fields = grok.AutoFields(IApplicantEdit).select(
     157                'firstname', 'middlename', 'lastname', 'email', 'phone')
     158            form_fields['phone'].custom_widget = PhoneWidget
     159        elif self.context.mode == 'update':
     160            form_fields = grok.AutoFields(IApplicantRegisterUpdate).select(
     161                'firstname','reg_number','email')
     162        return form_fields
Note: See TracChangeset for help on using the changeset viewer.