Changeset 15972 for main


Ignore:
Timestamp:
31 Jan 2020, 16:16:18 (5 years ago)
Author:
Henrik Bettermann
Message:

Add AccommodationDisplayFormPage

Location:
main/waeup.kofa/trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r15970 r15972  
    441.6.1.dev0 (unreleased)
    55=======================
     6
     7* Add `AccommodationDisplayFormPage`.
    68
    79* Don't allow students to add former courses in course lists.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r15970 r15972  
    22212221            omit_fields=self.omit_fields)
    22222222
     2223class AccommodationDisplayFormPage(KofaDisplayFormPage):
     2224    """ Page to view bed tickets.
     2225    This manage form page is for both students and students officers.
     2226    """
     2227    grok.context(IStudentAccommodation)
     2228    grok.name('index')
     2229    grok.require('waeup.viewStudent')
     2230    form_fields = grok.AutoFields(IStudentAccommodation)
     2231    grok.template('accommodationpage')
     2232    pnav = 4
     2233    with_hostel_selection = True
     2234
     2235    @property
     2236    def label(self):
     2237        return _('${a}: Accommodation',
     2238            mapping = {'a':self.context.__parent__.display_fullname})
     2239
     2240    @property
     2241    def desired_hostel(self):
     2242        if self.context.desired_hostel == 'no':
     2243            return _('No favoured hostel')
     2244        if self.context.desired_hostel:
     2245            hostel = grok.getSite()['hostels'].get(self.context.desired_hostel)
     2246            if hostel is not None:
     2247                return hostel.hostel_name
     2248        return
     2249
     2250    def update(self):
     2251        if checkPermission('waeup.handleAccommodation', self.context):
     2252            self.redirect(self.url(self.context, 'manage'))
    22232253
    22242254class AccommodationManageFormPage(KofaEditFormPage):
     
    22282258    """
    22292259    grok.context(IStudentAccommodation)
    2230     grok.name('index')
     2260    grok.name('manage')
    22312261    grok.require('waeup.handleAccommodation')
    22322262    form_fields = grok.AutoFields(IStudentAccommodation)
     
    24822512    grok.context(IBedTicket)
    24832513    grok.name('index')
    2484     grok.require('waeup.handleAccommodation')
     2514    grok.require('waeup.viewStudent')
    24852515    form_fields = grok.AutoFields(IBedTicket).omit('bed_coordinates')
    24862516    form_fields['booking_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     
    24972527    grok.context(IBedTicket)
    24982528    grok.name('bed_allocation_slip.pdf')
    2499     grok.require('waeup.handleAccommodation')
     2529    grok.require('waeup.viewStudent')
    25002530    form_fields = grok.AutoFields(IBedTicket).omit('bed_coordinates')
    25012531    form_fields['booking_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r15970 r15972  
    561561        self.browser.getLink("Accommodation").click()
    562562        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    563         self.assertEqual(self.browser.url, self.acco_path)
     563        # We have been redirected to the manage page
     564        self.assertEqual(self.browser.url, self.acco_path + '/manage')
    564565        self.browser.open(self.student_path)
    565566        self.browser.getLink("History").click()
  • main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py

    r15843 r15972  
    131131    grok.order(7)
    132132    grok.name('studentmanageaccommodationlink')
    133     grok.require('waeup.handleAccommodation')
     133    grok.require('waeup.viewStudent')
    134134    link = 'accommodation'
    135135    text = _(u'Accommodation')
     
    549549    grok.context(IBedTicket)
    550550    grok.view(BedTicketDisplayFormPage)
    551     grok.require('waeup.handleAccommodation')
     551    grok.require('waeup.viewStudent')
    552552    icon = 'actionicon_pdf.png'
    553553    text = _('Download bed allocation slip')
Note: See TracChangeset for help on using the changeset viewer.