Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Simplify saving collections for product
akjanik7f06a0372c79
diff --git a/saleor/dashboard/product/forms.py b/saleor/dashboard/product/forms.pyindex 578cd20d6c..171df30c4f 100644--- a/saleor/dashboard/product/forms.py+++ b/saleor/dashboard/product/forms.py@@ -171,17 +171,10 @@ class ProductForm(forms.ModelForm):else:attributes[smart_text(attr.pk)] = valueself.instance.attributes = attributes- instance = super().save(commit=False)-- def save_collections():- instance.collections.clear()- for collections in self.cleaned_data['collections']:- instance.collections.add(collections)- self.save_collections = save_collections-- if commit:- instance.save()- self.save_collections()+ instance = super().save()+ instance.collections.clear()+ for collection in self.cleaned_data['collections']:+ instance.collections.add(collection)return instance