0
之前創建的對象我想兩個物體之間的增量:獲得在該對象
class Point(models.Model):
measurement = models.ForeignKey(Measurement)
time = models.DateTimeField()
value = models.FloatField()
def delta(self):
measurement = self.measurement.point_set.order_by('time')
measurement = measurement[-2]
return self.value - measurement.value
但這顯然只是適用於最新的對象。有沒有辦法從時間意義上獲得self.object的前輩?