Answer the question
In order to leave comments, you need to log in
How to create objects while creating another object?
Hello, do you have models?
class Day(models.Model):
date = models.DateField()
class ReservedTable(models.Model):
is_reserved = models.BooleanField()
table = models.ForeignKey(Table, on_delete=models.CASCADE)
day = models.ForeignKey(Day, on_delete=models.CASCADE)
Answer the question
In order to leave comments, you need to log in
post_save signal on Day.
And there, already inside, go over the table and assign the day to the ReservedTable, which will fly to you in instance ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question