from django.db import models
from django.contrib.auth.models import User

from devilry.apps.core.models import RelatedStudent
from devilry.apps.core.models import Period


class QualifiesForFinalExam(models.Model):
    relatedstudent = models.OneToOneField(RelatedStudent)
    qualifies = models.BooleanField()


class QualifiesForFinalExamPeriodStatus(models.Model):
    STATUS_CHOICES = (
        ('ready', 'Ready for export'),
        ('almostready', 'Most students are ready for export'),
        ('notready', 'Not ready'),
    )
    period = models.ForeignKey(Period)
    status = models.SlugField(max_length=30, blank=False)
    createtime = models.DateTimeField(auto_now_add=True)
    message = models.TextField(blank=True)
    user = models.ForeignKey(User)
    plugin = models.CharField(max_length=500)
@@ -168,150 +168,8 @@
 od%0A%0A
-%0Aclass QualifiesForFinalExam(models.Model):%0A    relatedstudent = models.OneToOneField(RelatedStudent)%0A    qualifies = models.BooleanField()%0A%0A%0A
 clas
@@ -662,8 +662,249 @@
 gth=500)
+%0A%0A%0Aclass QualifiesForFinalExam(models.Model):%0A    relatedstudent = models.OneToOneField(RelatedStudent)%0A    status = models.ForeignKey(QualifiesForFinalExamPeriodStatus,%0A        related_name='students')%0A    qualifies = models.BooleanField()%0A

Make each qualification be part of a status.