class Comand(models.Model):
title = models.CharField(max_length=255)
photo = models.ImageField(upload_to='photos/%Y/%m/%d/')
first_evaluation = models.CharField(max_length=1, null=True)
second_appreciation = models.CharField(max_length=1, null=True)
third_assessment = models.CharField(max_length=1, null=True)
fourth_assessment = models.CharField(max_length=1, null=True)
fifth_assessment = models.CharField(max_length=1, null=True)
final_score = models.CharField(max_length=3, null=True)
cat = models.ForeignKey('Category', on_delete=models.PROTECT, null=True)
def save(self, *args, **kwargs):
self.final_score = self.first_evaluation + self.second_appreciation + self.third_assessment + self.fourth_assessment + self.fifth_assessment
super(Comand, self).save(*args, **kwargs)