Ignore:
Timestamp:
6 Nov 2013, 17:15:39 (13 years ago)
Author:
Henrik Bettermann
Message:

Add ICustomStudentPersonalEdit. Use custom interfaces in browser components.

Location:
main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/browser.py

    r10705 r10710  
    1818import grok
    1919from zope.i18n import translate
     20from zope.formlib.textwidgets import BytesDisplayWidget
    2021from zope.component import getUtility
    2122from hurry.workflow.interfaces import IWorkflowInfo
    … …  
    3940    NigeriaStudentClearanceEditFormPage,
    4041    NigeriaExportPDFCourseRegistrationSlipPage,
     42    NigeriaStudentPersonalDisplayFormPage,
     43    NigeriaStudentPersonalEditFormPage,
     44    NigeriaStudentPersonalManageFormPage
    4145    )
    4246
    43 from waeup.kwarapoly.students.interfaces import ICustomStudentOnlinePayment
     47from waeup.kwarapoly.students.interfaces import (
     48    ICustomStudentOnlinePayment,
     49    ICustomStudentPersonal,
     50    ICustomStudentPersonalEdit
     51    )
     52
     53class CustomStudentPersonalDisplayFormPage(NigeriaStudentPersonalDisplayFormPage):
     54    """ Page to display student personal data
     55    """
     56    form_fields = grok.AutoFields(ICustomStudentPersonal)
     57    form_fields['perm_address'].custom_widget = BytesDisplayWidget
     58    form_fields['next_kin_address'].custom_widget = BytesDisplayWidget
     59    form_fields['corr_address'].custom_widget = BytesDisplayWidget
     60    form_fields['sponsor_address'].custom_widget = BytesDisplayWidget
     61    form_fields[
     62        'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     63
     64class CustomStudentPersonalEditFormPage(NigeriaStudentPersonalEditFormPage):
     65    """ Page to edit personal data
     66    """
     67    form_fields = grok.AutoFields(ICustomStudentPersonalEdit).omit(
     68        'personal_updated')
     69
     70class CustomStudentPersonalManageFormPage(NigeriaStudentPersonalManageFormPage):
     71    """ Page to edit personal data
     72    """
     73    form_fields = grok.AutoFields(ICustomStudentPersonal)
     74    form_fields['personal_updated'].for_display = True
     75    form_fields[
     76        'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    4477
    4578class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage):
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/interfaces.py

    r10705 r10710  
    4545        title = _(u'Correspondence Address'),
    4646        required = False,
     47        )
     48
     49    sponsor_name = schema.TextLine(
     50        title = _(u'Sponsor\'s Name'),
     51        required = False,
     52        readonly = False,
     53        )
     54
     55    sponsor_address = schema.Text(
     56        title = _(u'Sponsor\'s Address'),
     57        required = False,
     58        readonly = False,
     59        )
     60
     61class ICustomStudentPersonalEdit(ICustomStudentPersonal):
     62    """Interface for editing personal data by students.
     63
     64    Here we can repeat the fields from IStudentPersonal and set the
     65    `required` if necessary.
     66    """
     67
     68    perm_address = schema.Text(
     69        title = _(u'Home Address'),
     70        required = True,
     71        )
     72
     73    corr_address = schema.Text(
     74        title = _(u'Correspondence Address'),
     75        required = True,
    4776        )
    4877
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/student.py

    r9347 r10710  
    2525from waeup.kofa.students.interfaces import IStudentNavigation
    2626from kofacustom.nigeria.students.student import NigeriaStudent
    27 from waeup.kwarapoly.students.interfaces import ICustomStudent
     27from waeup.kwarapoly.students.interfaces import (
     28    ICustomStudent, ICustomStudentPersonalEdit)
    2829
    2930class CustomStudent(NigeriaStudent):
    … …  
    3132    owned by students.
    3233    """
    33     grok.implements(ICustomStudent, IStudentNavigation)
     34    grok.implements(ICustomStudent,
     35        ICustomStudentPersonalEdit, IStudentNavigation)
    3436    grok.provides(ICustomStudent)
    3537
Note: See TracChangeset for help on using the changeset viewer.