Commit 98529434 authored by Alan Mitchell's avatar Alan Mitchell

Stopped Crash from occuring if Sensor Group is deleted.

Instead of Sensor Group set to Null, it now is set to the
Miscellaneous group, which is also the default sensor group.
parent 4c6d31a4
# Generated by Django 2.1.7 on 2019-09-26 20:06
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bmsapp', '0031_auto_20190909_2040'),
]
operations = [
migrations.AlterField(
model_name='bldgtosensor',
name='sensor_group',
field=models.ForeignKey(default=8, on_delete=django.db.models.deletion.SET_DEFAULT, to='bmsapp.SensorGroup'),
),
]
......@@ -446,7 +446,8 @@ class BldgToSensor(models.Model):
sensor = models.ForeignKey(Sensor, models.CASCADE)
# For this building, the sensor group that the sensor should be classified in.
sensor_group = models.ForeignKey(SensorGroup, models.SET_NULL, blank=True, null=True)
# The default value is for the "Miscellaneous" Sensor Group.
sensor_group = models.ForeignKey(SensorGroup, models.SET_DEFAULT, default=8)
# Within the sensor group, this field determines the sort order of this sensor.
sort_order = models.IntegerField(default=999)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment