Newer
Older
null=True, blank=True)
restrict_to_facility = models.CharField(max_length=200, blank=True, null=True,
verbose_name=_("Restrict to facility"),
help_text=_("If not blank, this exam ticket may only be used in the "
"given facility"))
require_login = models.BooleanField(
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 __unicode__(self):
return _("Exam ticket for %(participation)s in %(exam)s") % {
"participation": self.participation,
"exam": self.exam,
super().clean()
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