Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix address form to allow update without changing alias
Marek Brzóska1b381814a776
diff --git a/userprofile/forms.py b/userprofile/forms.pyindex 5e0a81f3b3..b6832ae50b 100644--- a/userprofile/forms.py+++ b/userprofile/forms.py@@ -1,7 +1,8 @@-from .models import Addressfrom django import formsfrom django.contrib.auth.models import AnonymousUser+from .models import Address+class AddressForm(forms.ModelForm):@@ -17,8 +18,9 @@ class AddressFormWithAlias(forms.ModelForm):exclude = ['user']def clean(self):- if Address.objects.filter(user=self.instance.user,- alias=self.cleaned_data['alias']).exists():+ if Address.objects.filter(+ user=self.instance.user, alias=self.cleaned_data['alias']+ ).exclude(id=self.instance.id).exists():self._errors['alias'] = self.error_class(['You are already using such alias for another address'])