def department_detail(request, department_id):\r
page_num = int(request.GET.get('page', 1))\r
count = int(request.GET.get('count', 5))\r
+\r
paginator = Paginator(models.Course.objects.\r
filter(department__id=department_id).\r
- filter(active=True).order_by('title'), count)\r
+ order_by('title'), count)\r
+\r
+ department = models.Department.objects.get(pk=department_id)\r
\r
- return g.render('courses.xhtml', paginator=paginator,\r
+ return g.render('courses.xhtml', \r
+ custom_title=_('Courses with Materials in %s') % department.name,\r
+ paginator=paginator,\r
page_num=page_num,\r
count=count)\r
\r
--- /dev/null
+<?python\r
+title = defined('custom_title') and custom_title or _('Departments')\r
+?>\r
+<html xmlns="http://www.w3.org/1999/xhtml"\r
+ xmlns:xi="http://www.w3.org/2001/XInclude"\r
+ xmlns:py="http://genshi.edgewall.org/">\r
+<xi:include href="master.xhtml"/>\r
+<xi:include href="paginate.xhtml"/>\r
+<head>\r
+ <title>${title}</title>\r
+ <script type="text/javascript">\r
+ <!-- !This ought to be in paginate.xhtml, not here. how to do? -->\r
+ $(function() { $('.pagetable').tablesorter(); });\r
+ </script>\r
+</head>\r
+<body>\r
+ <h1>${title}</h1>\r
+ <tr py:def="pageheader()">\r
+ <th>Department</th>\r
+ </tr>\r
+ <span py:def="pagerow(department)">\r
+ <td><a href="${ROOT}${department_url(department)}">${department.name}</a></td>\r
+ </span>\r
+ ${pagetable(paginator, count, pagerow, pageheader)}\r
+</body>\r
+</html>\r