ilya_shyian пре 1 година
родитељ
комит
4028947778
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      store_back/apps/categories/schema.py

+ 2 - 1
store_back/apps/categories/schema.py

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