[open-ils-commits] r144 - in servres/trunk/conifer: syrup templates (gfawcett)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Mar 7 20:49:16 EST 2009
Author: gfawcett
Date: 2009-03-07 20:49:15 -0500 (Sat, 07 Mar 2009)
New Revision: 144
Modified:
servres/trunk/conifer/syrup/models.py
servres/trunk/conifer/syrup/views.py
servres/trunk/conifer/templates/my_courses.xhtml
Log:
improved display of courses without course codes.
Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py 2009-03-08 01:48:58 UTC (rev 143)
+++ servres/trunk/conifer/syrup/models.py 2009-03-08 01:49:15 UTC (rev 144)
@@ -147,7 +147,7 @@
class Course(m.Model):
"""An offering of a course."""
- # some courses may be ad-hoc and have no code?
+ # some courses may be ad-hoc and have no code.
code = m.CharField(max_length=64, blank=True, null=True)
department = m.ForeignKey(Department)
term = m.ForeignKey(Term)
@@ -186,6 +186,12 @@
def __unicode__(self):
return self.code or self.title
+ def list_display(self):
+ if self.code:
+ return '%s: %s [%s]' % (self.term, self.title, self.code)
+ else:
+ return '%s: %s' % (self.term, self.title)
+
def items(self):
return self.item_set.all()
Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py 2009-03-08 01:48:58 UTC (rev 143)
+++ servres/trunk/conifer/syrup/views.py 2009-03-08 01:49:15 UTC (rev 144)
@@ -164,7 +164,7 @@
choices = [(a,a) for a in course_list]
choices.sort()
empty_label = u'---------'
- choices.insert(0, (0, empty_label))
+ choices.insert(0, ('', empty_label))
NewCourseForm.base_fields['code'].widget = Select(
choices = choices)
NewCourseForm.base_fields['code'].empty_label = empty_label
Modified: servres/trunk/conifer/templates/my_courses.xhtml
===================================================================
--- servres/trunk/conifer/templates/my_courses.xhtml 2009-03-08 01:48:58 UTC (rev 143)
+++ servres/trunk/conifer/templates/my_courses.xhtml 2009-03-08 01:49:15 UTC (rev 144)
@@ -18,7 +18,7 @@
?>
<p py:if="not my_courses">You are not part of any courses at this time.</p>
<p py:for="course in my_courses" style="font-size: large;">
- <a href="${course.id}/">${course.term}: ${course.code}: ${course.title}</a>
+ <a href="${course.id}/">${course.list_display()}</a>
</p>
<p><a href="new/">Add a new course</a></p>
<div class="gap"/>
More information about the open-ils-commits
mailing list