1 from django.db import models
2 from django.utils.translation import ugettext_lazy as _
4 class Section(models.Model):
5 name = models.CharField(_('name'), max_length=255)
6 slug = models.SlugField(_('slug'))
7 order = models.IntegerField(_('order'))
11 verbose_name = _('section')
12 verbose_name_plural = _('sections')
14 def __unicode__(self):
17 class Competence(models.Model):
18 section = models.ForeignKey(Section)
19 name = models.CharField(_('name'), max_length=255)
20 slug = models.SlugField(_('slug'))
21 order = models.IntegerField(_('order'))
25 verbose_name = _('competence')
26 verbose_name_plural = _('competences')
28 def __unicode__(self):
31 def for_level(self, level):
32 return self.competencelevel_set.get(level=level)
34 class Level(models.Model):
35 name = models.CharField(_('name'), max_length=255)
36 slug = models.SlugField(_('slug'))
37 order = models.IntegerField(_('order'))
41 verbose_name = _('educational level')
42 verbose_name_plural = _('educational levels')
44 def __unicode__(self):
47 class CompetenceLevel(models.Model):
48 competence = models.ForeignKey(Competence)
49 level = models.ForeignKey(Level)
50 description = models.TextField(_('description'))
53 ordering = ['competence', 'level']
54 verbose_name = _('competence on level')
55 verbose_name_plural = _('competences on levels')
57 def __unicode__(self):
58 return "%s/%s" % (self.competence, self.level)