Update startup scripts to update or create records rather than get/create

This commit is contained in:
Marco Ceppi
2020-07-09 14:49:23 -04:00
parent 8daeadf19e
commit 88f5430f05
10 changed files with 16 additions and 11 deletions

View File

@@ -23,7 +23,7 @@ with file.open('r') as stream:
if color in color_tpl:
params['color'] = color_tpl[0]
device_role, created = DeviceRole.objects.get_or_create(**params)
device_role, created = DeviceRole.objects.update_or_create(name=params['name'], defaults=params)
if created:
print("🎨 Created device role", device_role.name)