ilya_shyian преди 1 година
родител
ревизия
27d0f5aa5c
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. 3 3
      store_back/apps/categories/schema.py

+ 3 - 3
store_back/apps/categories/schema.py

@@ -140,10 +140,10 @@ class CategoryUpsert(graphene.Mutation):
                 print(category.get("parent",None) == "null")
                 print(category.get("parent",None))
 
-                if category.get("parent",None) == "null":
+                if not category.get("parent")["_id"] == "null":
                     new_category.parent = None
-                    
-                new_category.parent = Category.objects.get(_id=category.get("parent",None)["_id"])
+                else: 
+                    new_category.parent = Category.objects.get(_id=category.get("parent")["_id"])
             except:
                 raise Exception("Невірні дані (parent)")