Ignore:
Timestamp:
2 Jan 2010, 16:21:02 (15 years ago)
Author:
uli
Message:

Add a default page for faculty container.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-layout/src/waeup/browser/pages.py

    r4637 r4639  
    55from waeup.browser import WAeUPPage, WAeUPEditFormPage, WAeUPAddFormPage
    66from waeup.interfaces import (IUniversity, IWAeUPObject, IUserContainer,
    7                               IUserAccount)
     7                              IUserAccount, IFacultyContainer)
    88from waeup.widgets.interfaces import ITableProvider
    99from zope.app.security.interfaces import (IAuthentication,
     
    182182        self.redirect(self.url(self.context.__parent__))
    183183        return
     184
     185
     186#
     187# FacultyContainer pages...
     188#
     189
     190class FacultyContainerPage(WAeUPPage):
     191    grok.context(IFacultyContainer)
     192    grok.name('index')
     193    title = 'Faculties'
     194
     195    def update(self):
     196        self.table = ITableProvider(self.context).getTables(self)[0]
     197        self.table.need()
     198   
     199    def getFaculties(self):
     200        """Convinience method to create a sorted list of faculties.
     201
     202        It provides a list of dicts with entries for all data needed by
     203        usual list templates.
     204        """
     205        result = []
     206        for key, val in self.context.items():
     207            result.append(dict(id=key, name=val.title))
     208        return result
Note: See TracChangeset for help on using the changeset viewer.