Changeset 4442 for waeup


Ignore:
Timestamp:
27 Jul 2009, 14:57:39 (15 years ago)
Author:
uli
Message:

Provide course table for departments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/tables.py

    r4434 r4442  
    6464    def prepare(self):
    6565        self.data_source = self.context.faculties
     66
     67class CourseTableProvider(CodeAndTitleTableProvider):
     68    grok.context(IDepartment)
     69    grok.provides(ITableProvider)
     70    title = 'Courses'
     71
     72    def prepare(self):
     73        self.data_source = self.context.courses
     74       
     75    def getTable(self, view=None):
     76        data = self.data_source
     77        context_url = ''
     78        if view:
     79            context_url = view.url(self.context) + '/'
     80        cols = (
     81            Col(
     82                header='Code', sortable=True,
     83                data = tuple([self.getItemURL(view, data[x].code)
     84                              for x in data])),
     85            Col(
     86                header='Title', sortable=True,
     87                data = tuple([data[x].title for x in data])),
     88            )
     89        self.table = Table(self.title, cols=cols)
     90        return self.table
Note: See TracChangeset for help on using the changeset viewer.