fix save screen
This commit is contained in:
parent
e2c79cf698
commit
512b3dfba9
2 changed files with 17 additions and 15 deletions
|
@ -16,11 +16,11 @@ def update_repo():
|
||||||
if pull_status.returncode != 0:
|
if pull_status.returncode != 0:
|
||||||
logging.error("Error pulling repo")
|
logging.error("Error pulling repo")
|
||||||
|
|
||||||
def set_screen(args):
|
def set_screens(args):
|
||||||
#if type(args)
|
#if type(args)
|
||||||
screen = Screen.objects.filter(**args)
|
screen = Screen.objects.filter(**args)
|
||||||
if not screen.exists():
|
if not screen.exists():
|
||||||
screen = Screen()
|
screen = Screens()
|
||||||
for subkey, subvalue in args.items():
|
for subkey, subvalue in args.items():
|
||||||
if subkey == 'size':
|
if subkey == 'size':
|
||||||
size_mm = subvalue.split(' ')[0]
|
size_mm = subvalue.split(' ')[0]
|
||||||
|
@ -119,9 +119,9 @@ class Command(BaseCommand):
|
||||||
if type(value) is list:
|
if type(value) is list:
|
||||||
for s in value:
|
for s in value:
|
||||||
for k,v in s.items():
|
for k,v in s.items():
|
||||||
screen.append(set_screen(v))
|
screen.append(set_screens(v))
|
||||||
elif type(value) is dict:
|
elif type(value) is dict:
|
||||||
screen.append(set_screen(value))
|
screen.append(set_screens(value))
|
||||||
else:
|
else:
|
||||||
setattr(dev, key, value)
|
setattr(dev, key, value)
|
||||||
except yaml.YAMLError as exc:
|
except yaml.YAMLError as exc:
|
||||||
|
@ -131,5 +131,7 @@ class Command(BaseCommand):
|
||||||
dev.bluetooth = bluetooth
|
dev.bluetooth = bluetooth
|
||||||
for cam in cameras:
|
for cam in cameras:
|
||||||
dev.cameras.add(cam)
|
dev.cameras.add(cam)
|
||||||
|
for scr in screen:
|
||||||
|
dev.screen.add(scr)
|
||||||
dev.save()
|
dev.save()
|
||||||
|
|
Loading…
Reference in a new issue