34 lines
767 B
Python
34 lines
767 B
Python
from django.db import models
|
|
from students.models import Student
|
|
|
|
class Day(models.Model):
|
|
class Meta:
|
|
ordering = ('-date',)
|
|
|
|
date = models.DateField()
|
|
|
|
def __str__(self):
|
|
return f"{self.date}"
|
|
|
|
class Entry(models.Model):
|
|
class Meta:
|
|
verbose_name_plural = 'entries'
|
|
ordering = ('student',)
|
|
|
|
STATUS_CHOICES = [
|
|
('P', 'Present'),
|
|
('T', 'Tardy'),
|
|
('A', 'Absent'),
|
|
]
|
|
|
|
day = models.ForeignKey(Day, on_delete=models.CASCADE)
|
|
student = models.ForeignKey(Student, on_delete=models.CASCADE)
|
|
status = models.CharField(
|
|
max_length=1,
|
|
choices=STATUS_CHOICES,
|
|
default='P'
|
|
)
|
|
|
|
def __str__(self):
|
|
return f"{self.day} | {self.student} | {self.status}"
|