1 from django.db import models
2 from curriculum.models import Level
4 class Section(models.Model):
5 title = models.CharField(max_length=255, unique=True)
6 slug = models.SlugField(unique=True)
7 order = models.IntegerField()
12 def __unicode__(self):
15 class Lesson(models.Model):
16 section = models.ForeignKey(Section)
17 level = models.ForeignKey(Level)
18 title = models.CharField(max_length=255)
19 slug = models.SlugField(unique=True)
20 depth = models.IntegerField()
21 order = models.IntegerField()
23 xml_file = models.FileField(upload_to="catalogue/lesson/xml",
24 null=True, blank=True) # FIXME: slug in paths
25 package = models.FileField(upload_to="catalogue/lesson/package",
26 null=True, blank=True)
27 student_package = models.FileField(upload_to="catalogue/lesson/student",
28 null=True, blank=True)
29 html_file = models.FileField(upload_to="catalogue/lesson/html",
30 null=True, blank=True)
33 ordering = ['section', 'level', 'depth', 'order']
35 def __unicode__(self):
39 def get_absolute_url(self):
40 return ('catalogue_lesson', [self.slug])