我想在模板中将模型中的两个字段相乘并显示出来。 我有两个模型:
class Priority(models.Model):
priorityName=models.CharField(max_length=100)
priorityScore=models.IntegerField()
def __str__(self):
return str(self.priorityScore)
class ImpactMatrix(models.Model):
objectName=models.ForeignKey(ObjectName,on_delete=models.CASCADE)
actionName=models.ForeignKey(ActionObject,on_delete=models.CASCADE)
priority=models.ForeignKey(Priority,on_delete=models.CASCADE,related_name='priority')
functional=models.ForeignKey(Priority,on_delete=models.CASCADE,related_name='functional')
supervision=models.ForeignKey(Priority,on_delete=models.CASCADE,related_name='supervision')
approval=models.ForeignKey(Priority,on_delete=models.CASCADE,related_name='approval')
我想要将ImpactMatrix.priority * ImpactMatrix.functional的priorityScore乘以一个系数。
我该如何操作?