Ignore:
Timestamp:
28 Mar 2012, 06:23:25 (13 years ago)
Author:
Henrik Bettermann
Message:

Adapt changes recently made in the base package.

File:
1 edited

Legend:

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

    r7890 r7995  
    2424    StudentPersonalDisplayFormPage, StudentPersonalManageFormPage,
    2525    StudentClearanceManageFormPage, StudentClearanceEditFormPage,
    26     StudentClearanceDisplayFormPage)
     26    StudentClearanceDisplayFormPage,
     27    ExportPDFClearanceSlipPage)
    2728from waeup.kofa.students.viewlets import RequestCallbackActionButton
    2829from waeup.custom.students.interfaces import (
    29     IStudent, IStudentPersonal, IStudentClearance, IStudentClearanceEdit,
     30    IStudent, IStudentPersonal,
     31    IUGStudentClearance,IPGStudentClearance,
    3032    )
    3133from waeup.custom.interfaces import MessageFactory as _
     
    4850    """
    4951    grok.context(IStudent)
    50     form_fields = grok.AutoFields(IStudentClearance).omit('clearance_locked')
    51     form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le')
     52
     53    @property
     54    def form_fields(self):
     55        cm = getattr(self.context,'current_mode', None)
     56        if cm is not None and cm.startswith('pg'):
     57            form_fields = grok.AutoFields(IPGStudentClearance).omit('clearance_locked')
     58        else:
     59            form_fields = grok.AutoFields(IUGStudentClearance).omit('clearance_locked')
     60        form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le')
     61        return form_fields
     62
     63class ExportPDFClearanceSlipPage(ExportPDFClearanceSlipPage):
     64    """Deliver a PDF slip of the context.
     65    """
     66    grok.context(IStudent)
     67
     68    @property
     69    def form_fields(self):
     70        cm = getattr(self.context,'current_mode', None)
     71        if cm is not None and cm.startswith('pg'):
     72            form_fields = grok.AutoFields(IPGStudentClearance).omit('clearance_locked')
     73        else:
     74            form_fields = grok.AutoFields(IUGStudentClearance).omit('clearance_locked')
     75        form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le')
     76        return form_fields
    5277
    5378class StudentClearanceManageFormPage(StudentClearanceManageFormPage):
     
    5580    """
    5681    grok.context(IStudent)
    57     form_fields = grok.AutoFields(IStudentClearance)
    58     form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year')
     82
     83    @property
     84    def form_fields(self):
     85        cm = getattr(self.context,'current_mode', None)
     86        if cm is not None and cm.startswith('pg'):
     87            form_fields = grok.AutoFields(IPGStudentClearance)
     88        else:
     89            form_fields = grok.AutoFields(IUGStudentClearance)
     90        form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year')
     91        return form_fields
    5992
    6093class StudentClearanceEditFormPage(StudentClearanceEditFormPage):
     
    6295    """
    6396    grok.context(IStudent)
    64     form_fields = grok.AutoFields(
    65         IStudentClearanceEdit).omit('clearance_locked')
    66     form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year')
     97
     98    @property
     99    def form_fields(self):
     100        cm = getattr(self.context,'current_mode', None)
     101        if cm is not None and cm.startswith('pg'):
     102            form_fields = grok.AutoFields(IPGStudentClearance).omit('clearance_locked')
     103        else:
     104            form_fields = grok.AutoFields(IUGStudentClearance).omit('clearance_locked')
     105        form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year')
     106        return form_fields
    67107
    68108class RequestCallbackActionButton(RequestCallbackActionButton):
Note: See TracChangeset for help on using the changeset viewer.