title: How to get another related result in a django model
body: <p>Let's say I have this model in django:</p>
  <pre><code>class DeviceSensorChange(models.Model):
      device = models.ForeignKey(Device, on_delete=models.CASCADE, db_index=True)
      sensor = models.ForeignKey(DeviceDigitalSensor, on_delete=models.CASCADE, db_index=True, related_name='sensorchanges')
      time = models.DateTimeField(auto_now_add=True)
      value = models.BooleanField(default=False)
  </code></pre>
  <p>it describes how and when some &quot;sensors&quot; changes in time (a history of binary buttons: on and off).
  Then there is a ListView filtered by device or by sensor or by time.</p>
  <p>I want to add another column in the view, that shows the elapsed time since the last change of the same sensor in the same device: it means I should to go back in the table looking for the same device, same sensor, get the time and make the subtraction.</p>
  <p>Where is the right place to do that? I must not change the model and the information is needed just in the view to help the user, no need to store it.</p>
  <p>Is it possbile to add a elapsed() function in the model? Or this is something that has to be done in the template? Or in the ListView itself?</p>