1đź‘Ť
Perhaps the way to go about it is to have a separate class for assignment, something like this.
class Assignment(models.Model):
ASSIGNMENT_TYPES = (
('essay', "Essay"),
...
)
ASSIGNMENT_GRADES = (
('a+', "A+"),
('a', "A"),
...
)
student = models.ForeignKey("Student")
course = models.ForeignKey("Course")
assignment_type = models.CharField(choices=ASSIGNMENT_TYPES, max_length=15, default='essay')
progress = models.IntegerField()
grade = models.CharField(choices=ASSIGNMENT_GRADES, max_length=3, default="a+")
This way you have one assignment connected to one student and one course. It can be modified relatively easy if you have multiple students per one assignment, by adding another class (for example StudentGroup) and including it in the model.
Hope that this helps 🙂
0đź‘Ť
Create a model called “Assessments”, which has a foreign key to Course. In addition ,create a field called “Assessment Type”, another called “Assessment Result” and a final one called “Assesment Date”. Should look like this:
ASSESSMENTS = (('E','Essay'),('P','Presentation'))
class Assessment(models.MOdel):
course = models.ForeignKey('Course')
assessment = models.CharField(choices=ASESSMENTS)
result = models.CharField(max_length=250)
taken_on = models.DateField()
overall_result = models.BooleanField()
is_complete = models.BooleanField()
Each time there is an exam, you fill in a record in this table for each assessment taken. You can use the overall result as a flag to see if the student has passed or failed, and the is_complete to see if there are any exams pending for a course.
- [Answer]-Django DB design Guidance
- [Answer]-Automatic HTTPRedirect in Django view if user is authenticated?
- [Answer]-Can not see the result of query in template
- [Answer]-How to use Unicode for a ForeignKeyField, Django
- [Answer]-Modelform choices keyword as function with changing data
0đź‘Ť
You should look at models.py
file of classcomm,
a content management system written in Django for delivering and managing Courses on the Web.
It has following Models
- Department
- Course
- Instructor
- Mentor
- Enrollment
- Assignment
- DueDateOverride
- Submission
- Grade
- ExtraCredit
- Information
- Resource
- Announcement
You may not need such a complex relationship for you case, but it’s wort looking into it’s models design
.
You can find more details on homepage of this project.
- [Answer]-RequireJS call to "module"
- [Answer]-How to handle repeated records in django
- [Answer]-Django averages – average number of events per weekday