some changes to virtual command

This commit is contained in:
Tobias Kurze
2019-08-05 15:28:39 +02:00
parent 186614bc4a
commit 123eb65f8e

View File

@@ -77,17 +77,17 @@ class VirtualCommand(db.Model):
def command_order(self): def command_order(self):
if self.command_order_string is None: if self.command_order_string is None:
return [] return []
return self.command_order_string.split() return json.loads(self.command_order_string)
@command_order.setter @command_order.setter
def command_order(self, value: list): def command_order(self, ordered_list_of_commands: list):
pass self.command_order_string = json.dumps(ordered_list_of_commands)
def __str__(self): def __str__(self):
return self.name return self.name
def to_dict(self): def to_dict(self):
return dict(id=self.id, name=self.name) return dict(id=self.id, name=self.name, description=self.description)
def toJSON(self): def toJSON(self):
return json.dumps(self.to_dict(), default=lambda o: o.__dict__, return json.dumps(self.to_dict(), default=lambda o: o.__dict__,