debusy/schedule/models.py

32 lines
827 B
Python
Raw Permalink Normal View History

2020-04-09 12:11:12 +00:00
from django.db import models
# Create your models here.
2020-04-09 12:56:28 +00:00
class PickupDate(models.Model):
2020-04-13 11:59:45 +00:00
date = models.DateField('date of pickup', unique=True)
def __str__(self):
return str(self.date)
2020-04-09 12:56:28 +00:00
class Timeslot(models.Model):
start = models.TimeField('start of timeslot')
# open-ended for now
2020-04-13 11:59:45 +00:00
def __str__(self):
return self.start.isoformat(timespec='minutes')
class Meta:
ordering = ['start']
2020-04-09 12:56:28 +00:00
class Member(models.Model):
member_number = models.PositiveIntegerField(
verbose_name='aoff member number',
blank=True,
null=True,
)
class Pickup(models.Model):
date = models.ForeignKey(PickupDate, on_delete=models.CASCADE)
time = models.ForeignKey(Timeslot, on_delete=models.CASCADE)
member = models.ForeignKey(Member, on_delete=models.CASCADE)