donwload links
[edumed.git] / curriculum / models.py
index 14c916f..1f543b9 100644 (file)
@@ -24,7 +24,7 @@ class Competence(models.Model):
     order = models.IntegerField(_('order'))
 
     class Meta:
     order = models.IntegerField(_('order'))
 
     class Meta:
-        ordering = ['order']
+        ordering = ['section', 'order']
         verbose_name = _('competence')
         verbose_name_plural = _('competences')
 
         verbose_name = _('competence')
         verbose_name_plural = _('competences')
 
@@ -87,11 +87,13 @@ class CurriculumLevel(models.Model):
 
 class CurriculumCourse(models.Model):
     title = models.CharField(max_length=255)
 
 class CurriculumCourse(models.Model):
     title = models.CharField(max_length=255)
+    accusative = models.CharField(max_length=255)
     slug = models.CharField(max_length=255, db_index=True)
 
     class Meta:
         verbose_name = _("curriculum course")
         verbose_name_plural = _("curriculum courses")
     slug = models.CharField(max_length=255, db_index=True)
 
     class Meta:
         verbose_name = _("curriculum course")
         verbose_name_plural = _("curriculum courses")
+        ordering = ['slug']
 
     def __unicode__(self):
         return self.title
 
     def __unicode__(self):
         return self.title
@@ -122,9 +124,13 @@ class Curriculum(models.Model):
         assert m is not None, "Curriculum identifier doesn't match template."
         level, created = CurriculumLevel.objects.get_or_create(
                                        title=m.group('level'))
         assert m is not None, "Curriculum identifier doesn't match template."
         level, created = CurriculumLevel.objects.get_or_create(
                                        title=m.group('level'))
+        def_title = m.group('course').title()
         course, created = CurriculumCourse.objects.get_or_create(
         course, created = CurriculumCourse.objects.get_or_create(
-                                        slug=m.group('course'),
-                                        defaults={'title': m.group('course').title()})
+                                        slug=m.group('course').lower(),
+                                        defaults={
+                                            'title': def_title,
+                                            'accusative': def_title,
+                                        })
         type_ = m.group('type')
         if m.group('roz'):
             title += " (zakres rozszerzony)"
         type_ = m.group('type')
         if m.group('roz'):
             title += " (zakres rozszerzony)"