from django.db import models
from django.utils.translation import gettext as _


class MarkCriteria(models.Model):
    name = models.CharField(max_length=70, verbose_name=_('nazwa'))
    group = models.ForeignKey('MarkCriteriaGroup', related_name='marks', verbose_name=_(u'grupa ocen'))
    position = models.PositiveIntegerField(default=0, blank=True, verbose_name=_('pozycja'))

    class Meta:
        ordering = ('position',)
        verbose_name = _(u'kryterium oceny')
        verbose_name_plural = _(u'kryteria ocen')

    def __str__(self):
        return u'%s - %s' % (self.name, self.group.name)


class MarkCriteriaGroup(models.Model):
    name = models.CharField(max_length=70, verbose_name=_('nazwa'))
    position = models.PositiveIntegerField(default=0, blank=True, verbose_name=_('pozycja'))

    class Meta:
        ordering = ('position',)
        verbose_name = _('grupa kryteriów ocen')
        verbose_name_plural = _('grupy kryteriów ocen')

    def __str__(self):
        return u'%s' % self.name
