# rendering a Genshi template.
from itertools import cycle
-
from conifer.syrup import models
+# Root-relative URLs Django has its own way of doing this, by doing
+# reverse lookups in urlpatterns. Is there a benefit to their
+# approach?
+
def item_url(item, suffix=''):
return '/syrup/course/%d/item/%d/%s' % (item.course_id, item.id, suffix)
+
+def course_url(course, suffix=''):
+ return '/syrup/course/%d/%s' % (course.id, suffix)
</head>
<body>
<h1>${title}</h1>
- <p><a href="../../">${course_title}</a></p>
+ <p><a href="${course_url(course)}">${course_title}</a></p>
<p>${course.department}</p>
<p py:if="not item_tree">
There are no items associated in this subheading.
</head>
<body>
<h1>${title}</h1>
- <p><a href="../../">${course_title}</a></p>
+ <p><a href="${course_url(course)}">${course_title}</a></p>
<p>${course.department}</p>
<p>Title: ${item.title}</p>