Given the following models:
class Stream(models.Model):
name = models.CharField(max_length=32)
label = models.CharField(max_length=32)
...
class Data(models.Model):
class Meta:
ordering = ['timestamp']
timestamp = models.DateTimeField(db_index=True) # in UTC !
data = models.FloatField()
stream = models.ForeignKey(to=Stream, editable=False)
...
I need to output results in the following (CSV) format:
Example output:
Timestamp,A,B,C,D
2017/03/03:00:01:00,4,2,1.9,3
2017/03/03:00:01:15,4,3,1.8.3
...
A,B,C and D are streams labels.
Values are from Data.data field.