Pārlūkot izejas kodu

reed before commit

ash 2 gadi atpakaļ
vecāks
revīzija
accbf8ebc4
1 mainītis faili ar 14 papildinājumiem un 2 dzēšanām
  1. 14 2
      Backend/Sources/Model/model_manager.py

+ 14 - 2
Backend/Sources/Model/model_manager.py

@@ -1,5 +1,6 @@
 from pyexpat import model
 from sys import modules
+from tokenize import String
 from sqlalchemy.ext.declarative import DeclarativeMeta
 from sqlalchemy import null
 from utility.app_logging import *
@@ -110,6 +111,17 @@ def setModelItemAttributesFromJson(Item, JsonString):
         setattr(Item, key, attributes_dict[key])
 
 
-def ModelObjectToJsonString(object):
+def ModelObjectToJsonString(object) -> str:
 
-    return json.dumps(object, cls=ComplexEncoder)
+
+
+
+    json_string = json.dumps(object, cls=ComplexEncoder)
+    json_dict : dict = json.loads(json_string)
+    json_dict.pop("registry") # removing the registry item that comes from the sql alchemy type.
+    json_string = json.dumps(json_dict)
+
+    assert isinstance(json_string,str)
+
+
+    return json_string