Explorar el Código

change category assign

ilya_shyian hace 1 año
padre
commit
8e2c5e1251
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  1. 2 0
      store_back/apps/categories/schema.py

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

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