I have two models device and log setup as such:
class device(models.Model):
name = models.CharField(max_length=20)
code = models.CharField(max_length=10)
description = models.TextField()
class log(model.Model):
device = models.ForeignKey(device)
date = models.DateField()
time = models.TimeField()
data = models.CharField(max_length=50)
how do I get a list which contains only the most recent record/log (based on time and date) for each device and combine them in the format below:
name,code,date,time,data
being a Django newbie I would like to implement this using Django's ORM. TIA!