Hey i have a problem with my django model.
i have one class like this:
class Test(model.Models):
EV_Nr = models.IntegerField(unique=True)
Factor = models.DecimalField(max_digits=5, decimal_places=2, blank=False)
class Polter(models.Model):
EV = models.ForeignKey(Test)
RM = models.DecimalField(max_digits=10, decimal_places=2, default=0)
FM = models.DecimalField(max_digits=10, decimal_places=2, default=0)
My Problem:
RM or FM has to be 0, if both >0, it's an error and can not be saved.
but for example: RM = 10 and FM = 0. It's ok. -> and the model has to check for the Factor in my Test Model and to do the following: FM = RM / Faktor(from Test Model) and save it in my databese.
How can i do this. After two days of searching I have no idea.
Thanks for your help