diff --git a/feinstaub/sensors/migrations/0016_auto_20160209_2030.py b/feinstaub/sensors/migrations/0016_auto_20160209_2030.py new file mode 100644 index 0000000..1e69f20 --- /dev/null +++ b/feinstaub/sensors/migrations/0016_auto_20160209_2030.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.2 on 2016-02-09 20:30 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('sensors', '0015_sensordata_software_version'), + ] + + operations = [ + migrations.AlterModelOptions( + name='sensordatavalue', + options={}, + ), + migrations.AlterUniqueTogether( + name='sensordatavalue', + unique_together=set([('sensordata', 'value_type')]), + ), + ] diff --git a/feinstaub/sensors/models.py b/feinstaub/sensors/models.py index 537d152..2030394 100644 --- a/feinstaub/sensors/models.py +++ b/feinstaub/sensors/models.py @@ -100,6 +100,9 @@ class SensorDataValue(TimeStampedModel): value_type = models.CharField(max_length=100, choices=SENSOR_TYPE_CHOICES, db_index=True) + class Meta: + unique_together = (('sensordata', 'value_type', ), ) + def __str__(self): return "{sensordata}: {value} [{value_type}]".format( sensordata=self.sensordata,