]> git.parisson.com Git - teleforma.git/commitdiff
add slug to course
authoryomguy <yomguy@parisson.com>
Wed, 18 Apr 2012 09:31:23 +0000 (11:31 +0200)
committeryomguy <yomguy@parisson.com>
Wed, 18 Apr 2012 09:31:23 +0000 (11:31 +0200)
teleforma/models.py

index 00ef751de0847beb2cb7fa6128c0ac37ab379d8d..0de71fbf3a68a465e89ccee51747a6512919fde5 100755 (executable)
@@ -54,6 +54,7 @@ from django.contrib.contenttypes import generic
 from notes.models import Note
 import jqchat.models
 from django.core.paginator import InvalidPage, EmptyPage
+from django.template.defaultfilters import slugify
 
 app_label = 'teleforma'
 
@@ -126,6 +127,10 @@ class Course(Model):
     def __unicode__(self):
         return ' - '.join([self.department.name, self.title, self.type.name])
 
+    @property
+    def slug(self):
+        return slugify(self.__unicode__())
+        
     class Meta:
         db_table = app_label + '_' + 'course'
         verbose_name = _('course')