X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/6c9978c5bf8b1ef20871557c22b8b02df647d700..12313cd815102f970c09afc1999d26cec8d99d5c:/curriculum/models.py diff --git a/curriculum/models.py b/curriculum/models.py index 22de956..314fa1f 100644 --- a/curriculum/models.py +++ b/curriculum/models.py @@ -109,6 +109,7 @@ class Level(models.Model): prefix = 'Skrocony kurs/%d %s/' % (i, lesson.slug) lesson.add_to_zip(zipf, student, prefix) for c, (section, clessons) in enumerate(lessons['course'].items()): + assert section, clessons for i, lesson in enumerate(clessons): prefix = 'Pelny kurs/%d %s/%d %s/' % (c, section.slug, i, lesson.slug) lesson.add_to_zip(zipf, student, prefix) @@ -116,7 +117,14 @@ class Level(models.Model): prefix = 'Projekty/%d %s/' % (i, lesson.slug) lesson.add_to_zip(zipf, student, prefix) # Add all appendix lessons, from all levels. - for lesson in Lesson.objects.exclude(type__in=('synthetic', 'course', 'project')): + for lesson in Lesson.objects.filter(type='appendix'): + # ugly fix + if self.slug in ('przedszkole', 'sp1-3', 'sp4-6'): + if lesson.slug == 'slowniczek': + continue + else: + if lesson.slug == 'slowniczek-sp': + continue prefix = '%s/' % lesson.slug lesson.add_to_zip(zipf, student, prefix) zipf.close() @@ -184,13 +192,14 @@ class Curriculum(models.Model): """Official curriculum.""" TYPES = {'c': u'Cele kształcenia', 't': u'Treści nauczania'} - identifier = models.CharField(max_length=255, db_index=True) + identifier = models.CharField(max_length=255, db_index=True, unique=True) title = models.CharField(max_length=255) course = models.ForeignKey(CurriculumCourse) level = models.ForeignKey(CurriculumLevel) type = models.CharField(max_length=16, choices=TYPES.items()) class Meta: + ordering = ['identifier'] verbose_name = _("curriculum item") verbose_name_plural = _("curriculum items")