heya, We have a small project where we need to store a series of exam results for students.
Some exams receive a grade out of 100, others are simply a pass/fail, while others are given a one-word grade (e.g. pass, fail, credit, distinction). In a sense, they all do map to a 0 to 100 scale (e.g. for the pass/ fail, you can make it 0 and 100, while the pass/fail/credit/ distinction can be mapped to other numbers. However apparently the users don't want to store it that way, and want them each differentiated. Also, I suppose you'd need to store somehow which type of mark it was anyway, for when you need to represent it to the user. I was thinking of setting up abstract models to handle this, something like: class AssessmentTask(models.Model): name = models.CharField(max_length=20) paper = models.FileField(upload_to='forms/examination') date = models.DateField() class Meta: abstract = True class GradedAssessmentTask(AssessmentTask): mark = models.CharField(max_length=1, choices=ASSESSMENT_GRADE_CHOICES) class PassFailAssessmentTask(AssessmentTask): mark = models.BooleanField() class NumericalMarkAssessmentTask(AssessmentTask): mark = models.PositiveIntegerField() class ExaminationRecord(models.Model): assessment = models.OneToOneField(AssessmentTask) You could then create overridden methods to handle pass/fail checking for each of those. The ExaminationRecord object contains a list of assessments, each of which is of type AssessmentTask. However, Django complains with: AssertionError: OneToOneField cannot define a relation with abstract class AssessmentTask So obviously that's not the right way to handle this. What is the right way within Django to handle something like this? Cheers, Victor -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.