class Daily(models.Model):
rpt_date = models.DateField('Report Date', primary_key=True)
total_d_sors = models.IntegerField()
loaded_d_sors = models.IntegerField()
#diff_d_count
d_sors_missed_eod = models.CharField(max_length=300)
total_m_sors = models.IntegerField() #monthly
loaded_m_sors = models.IntegerField() #monthly
m_sors_missed_eod = models.CharField(max_length=300)
我的models.py中有上面的类,但是当我通过视图显示它时,我需要一个额外的列,它将在两个现有列(total_d_sors和missed_d_sors)之间产生差异,即diff_d_count =(total_d_sors -missed_d_sors).. . 有人可以帮忙吗?我看到了游标实现的例子;还有其他方法吗?