|
@@ -25,16 +25,18 @@ class Command(BaseCommand):
|
|
|
data = yaml.safe_load(stream)
|
|
|
dev = Device()
|
|
|
for key, value in data.items():
|
|
|
- print(key)
|
|
|
if key == "bluetooth":
|
|
|
+ # get() returned more than one Bluetooth -- it returned 2!
|
|
|
bt = Bluetooth.objects.filter(**value)
|
|
|
+ # __exact? https://docs.djangoproject.com/en/4.1/ref/models/querysets/#exact
|
|
|
if not bt.exists():
|
|
|
bt = Bluetooth()
|
|
|
for subkey, subvalue in value.items():
|
|
|
setattr(bt, subkey, subvalue)
|
|
|
bt.save()
|
|
|
- else:
|
|
|
- dev.bluetooth = bt.get()
|
|
|
+ else:
|
|
|
+ bt = bt.get()
|
|
|
+ dev.bluetooth = bt
|
|
|
elif key == "cameras":
|
|
|
print('camera')
|
|
|
# cam = []
|