Answer the question
In order to leave comments, you need to log in
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.
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
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 questionAsk a Question
731 491 924 answers to any question