I tried this
def save(self, *args, **kwargs):
super(Movie, self).save(*args, **kwargs)
self._create_seats()
but throws different error: FOREIGN KEY constraint failed
I tried this
def save(self, *args, **kwargs):
super(Movie, self).save(*args, **kwargs)
self._create_seats()
but throws different error: FOREIGN KEY constraint failed
The error would have more detail - which Foreign Key constraint failed?
Probably the movie field
I already solve the problem by setting the db_constraints to False. Thank you! <3
movie = models.ForeignKey(Movie, on_delete=models.CASCADE, db_constraint=False)