Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Simplify CategoryDelete mutation

Adam Janik13af4326256b
diff --git a/saleor/dashboard/graphql/product/mutations.py b/saleor/dashboard/graphql/product/mutations.py
index 5042bd41b3..dcc2f21e34 100644
--- a/saleor/dashboard/graphql/product/mutations.py
+++ b/saleor/dashboard/graphql/product/mutations.py
@@ -4,8 +4,8 @@ from ....graphql.product.types import Category
from ....graphql.utils import get_node
from ...category.forms import CategoryForm
from ..mutations import (
- BaseMutation, ModelFormMutation, ModelFormUpdateMutation)
-
+ ModelDeleteMutation, ModelFormMutation, ModelFormUpdateMutation)
+from ....product import models
class CategoryCreateMutation(ModelFormMutation):
class Arguments:
@@ -37,13 +37,7 @@ class CategoryUpdateMutation(ModelFormUpdateMutation):
return kwargs
-class CategoryDelete(BaseMutation):
- category = graphene.Field(Category)
-
- class Arguments:
- id = graphene.ID()
+class CategoryDelete(ModelDeleteMutation):
- def mutate(self, info, id):
- category = get_node(info, id, only_type=Category)
- category.delete()
- return CategoryDelete(category=category)
+ class Meta:
+ model = models.Category