[open-ils-commits] r118 - in servres/trunk/conifer: . syrup templates
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Jan 25 18:43:58 EST 2009
Author: artunit
Date: 2009-01-25 18:43:53 -0500 (Sun, 25 Jan 2009)
New Revision: 118
Modified:
servres/trunk/conifer/genshi_namespace.py
servres/trunk/conifer/syrup/urls.py
servres/trunk/conifer/syrup/views.py
servres/trunk/conifer/templates/instructors.xhtml
Log:
Modified: servres/trunk/conifer/genshi_namespace.py
===================================================================
--- servres/trunk/conifer/genshi_namespace.py 2009-01-25 21:25:49 UTC (rev 117)
+++ servres/trunk/conifer/genshi_namespace.py 2009-01-25 23:43:53 UTC (rev 118)
@@ -18,3 +18,9 @@
def course_url(course, suffix=''):
return '/syrup/course/%d/%s' % (course.id, suffix)
+
+def instructor_url(instructor, suffix=''):
+ return '/syrup/instructor/%d/%s' % (instructor.id, suffix)
+
+def department_url(department, suffix=''):
+ return '/syrup/department/%d/%s' % (department.id, suffix)
Modified: servres/trunk/conifer/syrup/urls.py
===================================================================
--- servres/trunk/conifer/syrup/urls.py 2009-01-25 21:25:49 UTC (rev 117)
+++ servres/trunk/conifer/syrup/urls.py 2009-01-25 23:43:53 UTC (rev 118)
@@ -16,6 +16,8 @@
(r'^search/$', 'search'),
(r'^instructors/$', 'instructors'),
(r'^course/(?P<course_id>\d+)/$', 'course_detail'),
+ (r'^instructor/(?P<instructor_id>.*)/$', 'instructor_detail'),
+ (r'^department/(?P<department_id>.*)/$', 'department_detail'),
(ITEM_PREFIX + r'$', 'item_detail'),
(ITEM_PREFIX + r'dl/(?P<filename>.*)$', 'item_download'),
(ITEM_PREFIX + r'meta/$', 'item_metadata'),
Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py 2009-01-25 21:25:49 UTC (rev 117)
+++ servres/trunk/conifer/syrup/views.py 2009-01-25 23:43:53 UTC (rev 118)
@@ -118,6 +118,28 @@
return login_required(lambda *args: None)(request)
return g.render('course_detail.xhtml', course=course)
+def instructor_detail(request, instructor_id):
+ page_num = int(request.GET.get('page', 1))
+ count = int(request.GET.get('count', 5))
+ paginator = Paginator(models.Course.objects.
+ filter(member__id=instructor_id).
+ filter(active=True).order_by('title'), count)
+
+ return g.render('courses.xhtml', paginator=paginator,
+ page_num=page_num,
+ count=count)
+
+def department_detail(request, department_id):
+ page_num = int(request.GET.get('page', 1))
+ count = int(request.GET.get('count', 5))
+ paginator = Paginator(models.Course.objects.
+ filter(department__id=department_id).
+ filter(active=True).order_by('title'), count)
+
+ return g.render('courses.xhtml', paginator=paginator,
+ page_num=page_num,
+ count=count)
+
def item_detail(request, course_id, item_id):
"""Display an item (however that makes sense)."""
# really, displaying an item will vary based on what type of item
@@ -314,6 +336,8 @@
#course search
course_query = get_query(query_string, ['title', 'department__name'])
+ print 'course_query'
+ print course_query
course_results = models.Course.objects.filter(course_query).filter(active=True)
# course_list = models.Course.objects.filter(course_query).filter(active=True).order_by('title')[0:5]
course_list = course_results.order_by('title')[0:5]
Modified: servres/trunk/conifer/templates/instructors.xhtml
===================================================================
--- servres/trunk/conifer/templates/instructors.xhtml 2009-01-25 21:25:49 UTC (rev 117)
+++ servres/trunk/conifer/templates/instructors.xhtml 2009-01-25 23:43:53 UTC (rev 118)
@@ -19,7 +19,7 @@
<th>Name</th>
</tr>
<span py:def="pagerow(item)">
- <td>${item.user.last_name}, ${item.user.first_name}</td>
+ <td><a href="${instructor_url(item.user)}">${item.user.last_name}, ${item.user.first_name}</a></td>
</span>
${pagetable(paginator, count, pagerow, pageheader)}
</body>
More information about the open-ils-commits
mailing list