Skip to content

Instantly share code, notes, and snippets.

@moritz89
Last active October 2, 2020 01:27
Show Gist options
  • Save moritz89/4efee0d37014356d3539be45ecf3e354 to your computer and use it in GitHub Desktop.
Save moritz89/4efee0d37014356d3539be45ecf3e354 to your computer and use it in GitHub Desktop.
class Sensor(models.Model):
name = models.CharField(max_length=50)
class SensorReading(models.Model):
time = models.DateTimeField(primary_key=True, default=datetime.now)
sensor = models.ForeignKey(Sensor, on_delete=models.CASCADE)
value = models.FloatField()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment