Ignore:
Timestamp:
12 Jun 2012, 07:17:01 (12 years ago)
Author:
Henrik Bettermann
Message:

Add hostel allocation start end end date attributes to hostels.

Move hostel allocation parameters from configuration to hostels. AccommodationOfficer? must be able to edit these parameters.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py

    r7833 r8685  
    3838from waeup.kofa.hostels.interfaces import (
    3939    IHostelsContainer, IHostel, IBed, IBedAllocateStudent)
     40from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
    4041
    4142def write_log_message(view, message):
     
    105106    label = _('Accommodation Section')
    106107    pnav = 5
     108    form_fields = grok.AutoFields(IHostelsContainer)
     109    form_fields[
     110        'startdate'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     111    form_fields[
     112        'enddate'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    107113
    108114class HostelsContainerManageActionButton(ManageActionButton):
     
    113119    text = _('Manage accommodation section')
    114120
    115 class HostelsContainerManagePage(KofaDisplayFormPage):
     121class HostelsContainerManagePage(KofaEditFormPage):
    116122    """The manage page for hostel containers.
    117123    """
     
    122128    pnav = 5
    123129    label = _('Manage accommodation section')
     130    form_fields = grok.AutoFields(IHostelsContainer)
     131    taboneactions = [_('Save')]
     132    tabtwoactions = [_('Add hostel'), _('Remove selected')]
    124133
    125134    def update(self):
     135        tabs.need()
     136        self.tab1 = self.tab2 = self.tab3 = self.tab4 = ''
     137        qs = self.request.get('QUERY_STRING', '')
     138        if not qs:
     139            qs = 'tab1'
     140        setattr(self, qs, 'active')
    126141        warning.need()
     142        datatable.need()
    127143        return super(HostelsContainerManagePage, self).update()
    128144
     
    146162    def addSubunit(self, **data):
    147163        self.redirect(self.url(self.context, 'addhostel'))
     164        return
     165
     166    @action(_('Save'), style='primary')
     167    def save(self, **data):
     168        self.applyData(self.context, **data)
     169        self.flash(_('Settings have been saved.'))
    148170        return
    149171
Note: See TracChangeset for help on using the changeset viewer.