Newer
Older
valid_end_time = models.DateTimeField(
verbose_name=_("End valid period"),
help_text=_("If not blank, date and time at which this exam ticket "
"stops being valid/usable"),
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"))
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