chat v2
This commit is contained in:
SDE
2023-08-09 14:06:43 +03:00
parent 73f791c8d9
commit e5d7116cad
8 changed files with 67 additions and 1 deletions

View File

@@ -34,6 +34,17 @@ class BaseModel(models.Model):
else:
return str(self.id)
def pop_node_by_name(self, node_name):
if not self.json_data or not node_name in self.json_data:
return None
res = self.json_data[node_name]
del self.json_data[node_name]
self.save(update_fields=['json_data'])
return res
def get_node_by_name(self, node_name):
if not self.json_data or not node_name in self.json_data:
return None