Skip to content
models.py 75.3 KiB
Newer Older
            default=False,
            help_text=_("If set, the exam ticket can only be used once logged in"))

    class Meta:
        verbose_name = _("Exam ticket")
        verbose_name_plural = _("Exam tickets")
        ordering = ("exam__course", "-creation_time")
        permissions = (
                ("can_issue_exam_tickets", _("Can issue exam tickets to student")),
                )
    def __str__(self) -> str:
        return _("Exam  ticket for %(participation)s in %(exam)s") % {
                "participation": self.participation,
                "exam": self.exam,
                }

    def clean(self):

        try:
            if self.exam.course != self.participation.course:
                raise ValidationError(_("Participation and exam must live "
                        "in the same course"))
        except ObjectDoesNotExist:
            pass

# vim: foldmethod=marker