N
N
nurzhannogerbek2018-06-07 11:11:52
Django
nurzhannogerbek, 2018-06-07 11:11:52

How to implement a schedule in Django?

Hello!
Could you advise how to correctly compose a data model for the following case. You need to implement something like this figure below.
5b18e64ae8034798621260.png
For example, there are data models Club and Trainer . How to create schedules in the Coach data model and link it to the time for a specific club? Do I need to make another data model for this? Perhaps someone has already encountered a similar problem and knows ready-made solutions. I will be glad for any hint.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2018-06-07
@nurzhannogerbek

class Trainer(models.Model):
    ...

class Club(models.Model):
    ...

class Schedule(models.Model):
    trainer = models.ForeignKey(Trainer)
    club = models.ForeignKey(Club)
    start_at = models.DateTimeField()
    end_till = models.DateTimeField()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question