How can I create sophisticated Django Model Validation for Django Admin?
问题 I have the following model in Django: class Bout (models.Model): fighter_1 = models.ForeignKey(Fighter, related_name="bout_fighter_1") fighter_2 = models.ForeignKey(Fighter, related_name="bout_fighter_2") winner = models.ForeignKey(Fighter, related_name="bout_winner", blank=True, null=True, help_text='Leave blank for draw.') date = models.DateField() cancelled = models.BooleanField() I would like to "idiot-proof" the administration for its records. Incidently, I want to create three rules: