I have a model Movie and a Model DefaultMoviePriceFor which saves the default prices for a specific genre:
class Movie(models.Model):
name = models.TextField('name', null=True)
genre = models.TextField('genre', null=True)
price = models.IntegerField('price', default=0)
class DefaultMoviePriceForGenre(models.Model):
genre = models.TextField('genre', null=True)
price = models.IntegerField('price', default=0)
Now I would like to fill up Movie.price with the default price of the Movie.genre everytime an object of Movie is instantiated.
Is there any good way to do so? I have SQL triggers in my head, they could do that, don't they? How is it done in django?