Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix review remarks
fowczarek83e60a92dd70
diff --git a/saleor/account/models.py b/saleor/account/models.pyindex 6fc30e4d1f..a6c487af15 100644--- a/saleor/account/models.py+++ b/saleor/account/models.py@@ -142,14 +142,12 @@ class User(PermissionsMixin, AbstractBaseUser):def get_full_name(self):if self.first_name or self.last_name:- not_empty_names = filter(None, [self.first_name, self.last_name])- return ' '.join(not_empty_names)+ return ('%s %s' % (self.first_name, self.last_name)).strip()if self.default_billing_address:- not_empty_names = list(filter(None, [- self.default_billing_address.first_name,- self.default_billing_address.last_name]))- if not_empty_names:- return ' '.join(not_empty_names)+ first_name = self.default_billing_address.first_name+ last_name = self.default_billing_address.last_name+ if first_name or last_name:+ return ('%s %s' % (first_name, last_name)).strip()return self.emaildef get_short_name(self):diff --git a/saleor/account/views.py b/saleor/account/views.pyindex 1f1e9077c9..376cf2b926 100755--- a/saleor/account/views.py+++ b/saleor/account/views.py@@ -103,7 +103,7 @@ def get_or_process_name_form(request):if form.is_valid():form.save()messages.success(request, pgettext(- 'Storefront message', 'Data successfully changed.'))+ 'Storefront message', 'Account successfully updated.'))return formdiff --git a/saleor/dashboard/staff/forms.py b/saleor/dashboard/staff/forms.pyindex fe93694dd8..7632c2e857 100644--- a/saleor/dashboard/staff/forms.py+++ b/saleor/dashboard/staff/forms.py@@ -3,16 +3,10 @@ from django.utils.translation import pgettext_lazyfrom ...account.models import Userfrom ...core.permissions import get_permissions+from ..customer.forms import get_name_placeholderfrom ..forms import PermissionMultipleChoiceField-def get_name_placeholder(name):- return pgettext_lazy(- 'Customer form: Name field placeholder',- '%(name)s (Inherit from default biling address)') % {- 'name': name}--class StaffForm(forms.ModelForm):user_permissions = PermissionMultipleChoiceField(queryset=get_permissions(),diff --git a/tests/dashboard/test_customer.py b/tests/dashboard/test_customer.pyindex 435f052284..b2f93b6637 100644--- a/tests/dashboard/test_customer.py+++ b/tests/dashboard/test_customer.py@@ -50,7 +50,7 @@ def test_add_customer_form():assert User.objects.count() == user_count + 1-def test_add_names_to_customer(customer_user):+def test_edit_customer_names(customer_user):customer = customer_usercustomer_form = CustomerForm({'first_name': 'Jan', 'last_name': 'Nowak', 'email': customer.email},diff --git a/tests/test_account.py b/tests/test_account.pyindex 5fea597d5c..816036fb4c 100644--- a/tests/test_account.py+++ b/tests/test_account.py@@ -287,7 +287,7 @@ def test_view_account_delete_confirm(customer_user, authorized_client):assert customer_user is None-def test_add_names_to_user(customer_user):+def test_form_add_names_to_user(customer_user):name_form = NameForm({'first_name': 'Jan', 'last_name': 'Nowak'},instance=customer_user)@@ -298,7 +298,7 @@ def test_add_names_to_user(customer_user):assert updated_user.last_name == 'Nowak'-def test_add_names_to_user_post(customer_user, authorized_client):+def test_view_add_names_to_user(customer_user, authorized_client):url = reverse('account:details')response = authorized_client.post(url, data={'first_name': 'Jan', 'last_name': 'Nowak'})