-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8e287e
commit b95a3ab
Showing
2 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from django.db import models | ||
|
||
|
||
class Student(models.Model): | ||
student_id = models.CharField(max_length=20, unique=True) | ||
name = models.CharField(max_length=100) | ||
subjects = models.ManyToManyField('Vak', related_name='students_enrolled') | ||
|
||
def __str__(self): | ||
return self.name | ||
|
||
class Lesgever(models.Model): | ||
lesgever_id = models.CharField(max_length=20, unique=True) | ||
name = models.CharField(max_length=100) | ||
subjects = models.ManyToManyField('Vak', related_name='lesgevers_enrolled') | ||
is_admin = models.BooleanField(default=False) | ||
|
||
def __str__(self): | ||
return self.name | ||
|
||
class Vak(models.Model): | ||
vak_id = models.AutoField(primary_key=True) | ||
name = models.CharField(max_length=100) | ||
students = models.ManyToManyField('Student', related_name='subjects_enrolled', blank=True) | ||
teachers = models.ManyToManyField('Lesgever', related_name='subjects_teachers') | ||
projects = models.ManyToManyField('Project', related_name='subjects_projects', blank=True) | ||
|
||
def __str__(self): | ||
return self.name | ||
|
||
class Groep(models.Model): | ||
group_id = models.AutoField(primary_key=True) | ||
students = models.ManyToManyField('Student', related_name='groups_students', blank=True) | ||
project = models.ForeignKey('Project', on_delete=models.CASCADE) | ||
|
||
def __str__(self): | ||
return f"Group {self.group_id}" | ||
|
||
class Project(models.Model): | ||
project_id = models.AutoField(primary_key=True) | ||
titel = models.CharField(max_length=100) | ||
description = models.TextField() | ||
opgavebestanden = models.FileField(upload_to='opgave/') | ||
vak = models.ForeignKey(Vak, on_delete=models.CASCADE) | ||
deadline = models.DateTimeField(null=True) | ||
# indiening restricties | ||
|
||
def __str__(self): | ||
return self.titel | ||
|
||
class Indiening(models.Model): | ||
indiening_id = models.AutoField(primary_key=True) | ||
indiener = models.ForeignKey('Groep', on_delete=models.CASCADE) | ||
indieningsbestanden = models.FileField(upload_to='uploads/') | ||
tijdstip = models.DateTimeField(null=False) | ||
|
||
def __str__(self): | ||
return self.tijdstip | ||
|
||
class Score(models.Model): | ||
score = models.SmallIntegerField() | ||
indiening = models.ForeignKey('Indiening', on_delete=models.CASCADE) | ||
groep = models.ForeignKey('Groep', on_delete=models.CASCADE) | ||
|
||
def __str__(self): | ||
return self.score | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b95a3ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zijn er hiervoor extra libraries geinstalleerd?
b95a3ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nee, enkel 'api' en 'rest_framework' zijn toegevoegd, en ik heb blijkbaar per ongeluk ook mijn allowed_host laten staan