Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
#200 modellen aanpassen voor studenten templates
Browse files Browse the repository at this point in the history
Signed-off-by: novdamme <[email protected]>
  • Loading branch information
novdamme committed Apr 16, 2023
1 parent 0dd6480 commit 520f3b8
Showing 1 changed file with 56 additions and 40 deletions.
96 changes: 56 additions & 40 deletions backend/planning/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,102 @@
from django.conf import settings
from ronde.models import Ronde
from trashtemplates.models import TrashContainerTemplate
from pickupdays.models import PickUpDay


class WeekPlanning(models.Model):
class DagPlanning(models.Model):
"""
All the day plans for a certain week
The planning for one Ronde on a specific day
Attributes
----------
week : models.IntegerField
The week of the year for this planning
students : models.ManyToMany
The students that will be doing this round
year : models.IntegerField
The year of this planning
date : models.ForeignKey
The date on which this student will do this round.
Only the weekday is stored so the object can be reused in templates.
trash_templates: models.ManyToManyField(TrashContainerTemplate)
The trashtemplates for this week
ronde : models.ForeignKey
The round that the students will do this day
"""
week = models.IntegerField()
students = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True)

year = models.IntegerField()
date = models.ForeignKey(PickUpDay, on_delete=models.DO_NOTHING)

trash_templates = models.ManyToManyField(TrashContainerTemplate, blank=True)
ronde = models.ForeignKey(
Ronde,
on_delete=models.DO_NOTHING
)


class DagPlanning(models.Model):
class StudentTemplate(models.Model):
"""
The planning for 1 student for 1 day
All the day templates for a certain week
Attributes
----------
student : models.OneToOneField
The student that will be doing this round
name : models.TextField
The name of this template
date : models.DateField
The date on which this student will do this round
dag_planningen : models.ManyToManyField
The DagPlanning objects of this template
ronde : models.ForeignKey
The round that the student will do this day
"""
name = models.TextField()
dag_planningen = models.ManyToManyField(DagPlanning)

info : models.ForeignKey
All the info from the student about all the buildings


class WeekPlanning(models.Model):
"""
student = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)
All the day templates for a certain week
date = models.DateField()
Attributes
----------
week : models.IntegerField
The week of the year for this planning
ronde = models.ForeignKey(
Ronde,
on_delete=models.DO_NOTHING
)
year : models.IntegerField
The year of this planning
weekPlanning = models.ForeignKey(WeekPlanning, on_delete=models.DO_NOTHING)
trash_templates: models.ManyToManyField(TrashContainerTemplate)
The trash templates for this week
student_templates: models.ManyToManyField(StudentTemplate)
The student templates for this week
class InfoPerBuilding(models.Model):
"""
Info about a building in a round database model.
week = models.IntegerField()

Attributes
----------
arrival : models.ForeignKey
The images taken when the student arrives on location
year = models.IntegerField()

storage : models.ForeignKey
The images taken when the student is in the storage location
trash_templates = models.ManyToManyField(TrashContainerTemplate, blank=True)
student_templates = models.ManyToManyField(StudentTemplate, blank=True)

departure : models.ForeignKey
The images taken when the student departs

extra : models.ForeignKey
Extra images the student has taken
class InfoPerBuilding(models.Model):
"""
Info about a building in a round database model.
Attributes
----------
remark : models.TextField
The remarks about the building
date : models.DateField
The date when this info was created.
Because of this we can reuse DagPlanning objects.
dagPlanning : models.ForeignKey
The associated DagPlanning
"""

remark = models.TextField(default="")

date = models.DateField()

dagPlanning = models.ForeignKey(DagPlanning, on_delete=models.CASCADE)


Expand Down

0 comments on commit 520f3b8

Please sign in to comment.