constrain Member class: (course,user) must be unique.
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Mon, 9 Mar 2009 23:49:24 +0000 (23:49 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Mon, 9 Mar 2009 23:49:24 +0000 (23:49 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@159 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/syrup/models.py
conifer/templates/edit_course_permissions.xhtml

index 673d642..44646c9 100644 (file)
@@ -291,6 +291,9 @@ def section_encode_safe(section):
     return course_sections.sections_tuple_delimiter.join(section).encode('base64').strip()
 
 class Member(m.Model):
+    class Meta:
+        unique_together = (('course', 'user'))
+
     course = m.ForeignKey(Course)
     user = m.ForeignKey(User)
     role = m.CharField(
index ab8f15c..a921da7 100644 (file)
@@ -28,7 +28,7 @@ instructors = [m for m in models.Member.objects.filter(course=course) if m.role
                            [(u'INSTR',_(u'Instructor')), (u'PROXY', _(u'Proxy instructor'))])
                            .render('instructor_role_%d' % mbr.id, mbr.role))"/>
       <tr py:for="mbr in instructors">
-       <td>${mbr.user.get_full_name() or mbr.user}</td>
+       <td>${mbr.user.get_full_name() or ''} <code>(${mbr.user.username})</code></td>
        <td>${select_role(mbr)}</td>
        <td><input type="checkbox" name="instructor_remove_${mbr.id}"/></td>
       </tr>