I'm new to Django and I have a question (Yes, yes, I was looking for and did't find ...). There are two models:
class CounterDetail(models.Model):
counter = models.ForeignKey(Counter, on_delete=models.CASCADE)
date_placing = models.DateField(auto_now=False, auto_now_add=False, blank=False, null=False)
verifying_period_mounts = models.IntegerField(blank=False, null=False)
and
class Detail(models.Model):
counterdetail = models.ForeignKey(CounterDetail, on_delete=models.CASCADE)
date_last_verification = models.DateField(auto_now=False, auto_now_add=False, blank=False, null=False)
date_obxoda = models.DateField(auto_now=False, auto_now_add=False, blank=False, null=False)
How to implement the check when adding an entry to the second model through the admin panel:
field date_obxoda = models.DateField(auto_now=False, auto_now_add=False, blank=False, null=False)
more then date_placing = models.DateField(auto_now=False, auto_now_add=False, blank=False, null=False) from another model.
I'm looking for a method (preferably as an overridden save () method in the model) when adding records via the admin panel, to verify that the date from the second model (with a foreign key) is greater than the first.
Please give an example, thank you.