Skip to content

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

Update comment in validate_slug_and_generate_if_needed

IKarbowiak0c7707209dfa
diff --git a/saleor/graphql/core/utils/__init__.py b/saleor/graphql/core/utils/__init__.py
index 68884292f4..bcd39e3b9f 100644
--- a/saleor/graphql/core/utils/__init__.py
+++ b/saleor/graphql/core/utils/__init__.py
@@ -77,9 +77,9 @@ def validate_slug_and_generate_if_needed(
slug_field_name: str = "slug",
) -> dict:
"""Validate slug from input and generate in create mutation if is not given."""
+
# update mutation - just check if slug value is not empty
- # we use _state.adding to checking if instance is saved because if pk has default
- # value it is set before save
+ # _state.adding is True only when it's new not saved instance.
if not instance._state.adding: # type: ignore
validate_slug_value(cleaned_input)
return cleaned_input