mirror of
https://github.com/daniviga/bite.git
synced 2024-11-23 13:26:14 +01:00
18 lines
468 B
Python
18 lines
468 B
Python
|
from django.db import models
|
||
|
from django.contrib.postgres.fields import JSONField
|
||
|
|
||
|
from api.models import Device
|
||
|
|
||
|
|
||
|
class Telemetry(models.Model):
|
||
|
device = models.ForeignKey(Device, on_delete=models.CASCADE)
|
||
|
time = models.DateTimeField(auto_now_add=True)
|
||
|
payload = JSONField()
|
||
|
|
||
|
class Meta:
|
||
|
ordering = ['time', 'device']
|
||
|
verbose_name_plural = "Telemetry"
|
||
|
|
||
|
def __str__(self):
|
||
|
return "%s - %s" % (self.time, self.device.serial)
|