samedi 27 novembre 2021

Timetable in django

In my django app i would like to create a timetable showing all appointments per day. For example:

Time   | Seat 1   | Seat 2 | etc
9:00am  John Doe   Jim Doe
10:00am John Doe   Jim Doe

Currently i have models for appoint and seat:

class Appointment(models.Model):

    user = models.ForeignKey(Account, on_delete=models.CASCADE)
    seat = models.ForeignKey(Seat, on_delete=models.SET_NULL, null=True)
    start_appointment = models.DateTimeField(default=timezone.now, blank=True)
    end_appointment = models.DateTimeField(default=timezone.now, blank=True)
    name = models.CharField(max_length=255)
    date_created = models.DateTimeField(_('Date Created'), auto_now_add=True)
    date_updated = models.DateTimeField(_('Date Updated'), auto_now=True)

class Seat(models.Model):
    name = models.CharField(max_length=255)
    slug = models.SlugField()
    short_description = models.TextField(blank=True, null=True)
    created_at = models.DateField(auto_now_add=True)

Could you please propose a way or steps of how to achieve that?

Aucun commentaire:

Enregistrer un commentaire