Skip to content

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

Change urls to account instead of profile

Anna Siwik361c2eb150e8
diff --git a/saleor/account/views.py b/saleor/account/views.py
index 374b105c09..4d3d361ed2 100755
--- a/saleor/account/views.py
+++ b/saleor/account/views.py
@@ -46,7 +46,7 @@ def address_edit(request, pk):
message = pgettext(
'Storefront message', 'Address successfully updated.')
messages.success(request, message)
- return HttpResponseRedirect(reverse('profile:details') + '#addresses')
+ return HttpResponseRedirect(reverse('account:details') + '#addresses')
return TemplateResponse(
request, 'account/address_edit.html',
{'address_form': address_form})
@@ -60,6 +60,6 @@ def address_delete(request, pk):
messages.success(
request,
pgettext('Storefront message', 'Address successfully removed'))
- return HttpResponseRedirect(reverse('profile:details') + '#addresses')
+ return HttpResponseRedirect(reverse('account:details') + '#addresses')
return TemplateResponse(
request, 'account/address_delete.html', {'address': address})
diff --git a/saleor/checkout/core.py b/saleor/checkout/core.py
index 97c3d04ed0..b3335c4219 100644
--- a/saleor/checkout/core.py
+++ b/saleor/checkout/core.py
@@ -9,6 +9,8 @@ from django.utils.encoding import smart_text
from django.utils.translation import get_language
from prices import FixedDiscount, Price
+from ..account.models import Address
+from ..account.utils import store_user_address
from ..cart.models import Cart
from ..cart.utils import get_or_empty_db_cart
from ..core import analytics
@@ -16,8 +18,6 @@ from ..discount.models import NotApplicable, Voucher
from ..discount.utils import increase_voucher_usage
from ..order.models import Order
from ..shipping.models import ANY_COUNTRY, ShippingMethodCountry
-from ..account.models import Address
-from ..account.utils import store_user_address
STORAGE_SESSION_KEY = 'checkout_storage'
diff --git a/saleor/core/views.py b/saleor/core/views.py
index ef3ae0c273..7618831aba 100644
--- a/saleor/core/views.py
+++ b/saleor/core/views.py
@@ -5,9 +5,9 @@ from django.template.response import TemplateResponse
from django.utils.translation import pgettext_lazy
from impersonate.views import impersonate as orig_impersonate
+from ..account.models import User
from ..dashboard.views import staff_member_required
from ..product.utils import products_for_homepage, products_with_availability
-from ..account.models import User
from .utils.schema import get_webpage_schema
diff --git a/saleor/order/models.py b/saleor/order/models.py
index 5b2df499c9..a8d89fbdb0 100644
--- a/saleor/order/models.py
+++ b/saleor/order/models.py
@@ -15,13 +15,13 @@ from payments.models import BasePayment
from prices import FixedDiscount, Price
from satchless.item import ItemLine, ItemSet
-from . import GroupStatus, OrderStatus, emails
+from ..account.models import Address
from ..core.utils import build_absolute_uri
from ..discount.models import Voucher
from ..product.models import Product
-from ..account.models import Address
from .transitions import (
cancel_delivery_group, process_delivery_group, ship_delivery_group)
+from . import GroupStatus, OrderStatus, emails
class OrderQuerySet(models.QuerySet):
diff --git a/saleor/order/utils.py b/saleor/order/utils.py
index e664acdc6c..006c8c30ca 100644
--- a/saleor/order/utils.py
+++ b/saleor/order/utils.py
@@ -7,9 +7,9 @@ from django.utils.translation import pgettext_lazy
from prices import Price
from satchless.item import InsufficientStock
-from . import GroupStatus
-from ..product.utils import allocate_stock
from ..account.utils import store_user_address
+from ..product.utils import allocate_stock
+from . import GroupStatus
def check_order_status(func):
diff --git a/saleor/order/views.py b/saleor/order/views.py
index e9cd6d35d3..47b7ea1a9e 100644
--- a/saleor/order/views.py
+++ b/saleor/order/views.py
@@ -10,14 +10,14 @@ from django.template.response import TemplateResponse
from django.utils.translation import pgettext_lazy
from payments import PaymentStatus, RedirectNeeded
-from . import OrderStatus
+from ..account.models import User
from ..core.utils import get_client_ip
from ..registration.forms import LoginForm
-from ..account.models import User
from .forms import (
OrderNoteForm, PasswordForm, PaymentDeleteForm, PaymentMethodsForm)
from .models import Order, OrderNote, Payment
from .utils import attach_order_to_user, check_order_status
+from . import OrderStatus
logger = logging.getLogger(__name__)
@@ -182,7 +182,7 @@ def connect_order_with_user(request, token):
"We couldn't assign the order to your account as the email"
" addresses don't match")
messages.warning(request, msg)
- return redirect('profile:details')
+ return redirect('account:details')
attach_order_to_user(order, request.user)
msg = pgettext_lazy(
'storefront message',
diff --git a/saleor/search/documents.py b/saleor/search/documents.py
index 11b64e386b..48c624af2d 100644
--- a/saleor/search/documents.py
+++ b/saleor/search/documents.py
@@ -1,9 +1,9 @@
from django_elasticsearch_dsl import DocType, Index, fields
from elasticsearch_dsl import analyzer, token_filter
+from ..account.models import User
from ..order.models import Order
from ..product.models import Product
-from ..account.models import User
storefront = Index('storefront')
storefront.settings(number_of_shards=1, number_of_replicas=0)
diff --git a/saleor/urls.py b/saleor/urls.py
index 634a78c409..dda91d0eb9 100644
--- a/saleor/urls.py
+++ b/saleor/urls.py
@@ -6,6 +6,7 @@ from django.contrib.staticfiles.views import serve
from django.views.i18n import JavaScriptCatalog
from graphene_django.views import GraphQLView
+from .account.urls import urlpatterns as account_urls
from .cart.urls import urlpatterns as cart_urls
from .checkout.urls import urlpatterns as checkout_urls
from .core.sitemaps import sitemaps
@@ -16,7 +17,6 @@ from .order.urls import urlpatterns as order_urls
from .product.urls import urlpatterns as product_urls
from .registration.urls import urlpatterns as registration_urls
from .search.urls import urlpatterns as search_urls
-from .account.urls import urlpatterns as userprofile_urls
handler404 = 'saleor.core.views.handle_404'
@@ -33,8 +33,8 @@ urlpatterns = [
url(r'^order/', include((order_urls, 'order'), namespace='order')),
url(r'^products/',
include((product_urls, 'product'), namespace='product')),
- url(r'^profile/',
- include((userprofile_urls, 'profile'), namespace='profile')),
+ url(r'^account/',
+ include((account_urls, 'account'), namespace='account')),
url(r'^feeds/',
include((feed_urls, 'data_feeds'), namespace='data_feeds')),
url(r'^search/', include((search_urls, 'search'), namespace='search')),
diff --git a/templates/account/address_delete.html b/templates/account/address_delete.html
index b7a20c1c4f..9a82cc6e86 100644
--- a/templates/account/address_delete.html
+++ b/templates/account/address_delete.html
@@ -1,6 +1,6 @@
{% load i18n %}
<div class="address-delete none">
- <form method="post" novalidate action="{% url 'profile:address-delete' pk=address.pk %}">
+ <form method="post" novalidate action="{% url 'account:address-delete' pk=address.pk %}">
{% csrf_token %}
<button type="submit" class="btn danger narrow float-right">
{% trans "Remove Address" context "Remove address form action" %}
diff --git a/templates/account/address_edit.html b/templates/account/address_edit.html
index 0266810e06..a0d8129bf7 100644
--- a/templates/account/address_edit.html
+++ b/templates/account/address_edit.html
@@ -17,7 +17,7 @@
</a>
</li>
<li>
- <a href="{% url "profile:details" %}">
+ <a href="{% url "account:details" %}">
{% trans "Your profile" context "Edit/new address breadcrumb" %}
</a>
</li>
diff --git a/templates/account/details.html b/templates/account/details.html
index 6ce0763581..20f6b9e77d 100644
--- a/templates/account/details.html
+++ b/templates/account/details.html
@@ -123,7 +123,7 @@
{% format_address address %}
<ul class="icons">
<li>
- <a href="{% url "profile:address-edit" pk=address.pk %}">
+ <a href="{% url "account:address-edit" pk=address.pk %}">
{% trans "Edit" context "User address action" %}
</a>
</li>
diff --git a/templates/account/password_change.html b/templates/account/password_change.html
index 869fee7229..737cfaf95b 100644
--- a/templates/account/password_change.html
+++ b/templates/account/password_change.html
@@ -5,7 +5,7 @@
{% block breadcrumb %}
<ul class="breadcrumbs list-unstyled">
<li><a href="{% url 'home' %}">{% trans "Home" context "Main navigation item" %}</a></li>
- <li><a href="{% url 'profile:details' %}">{% trans "Your account" context "Main navigation item" %}</a></li>
+ <li><a href="{% url 'account:details' %}">{% trans "Your account" context "Main navigation item" %}</a></li>
<li><a href="{% url 'home' %}">{% trans "Edit" context "Password change breadcrumb" %}</a></li>
</ul>
{% endblock breadcrumb %}
diff --git a/templates/base.html b/templates/base.html
index ab2c34d079..12b3d0c380 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -56,7 +56,7 @@
</li>
{% endif %}
<li>
- <a href="{% url "profile:details" %}">
+ <a href="{% url "account:details" %}">
{% trans "Your account" context "Main navigation item" %}</a>
</li>
{% if user.is_impersonate %}
@@ -214,7 +214,7 @@
</li>
{% endif %}
<li>
- <a href="{% url "profile:details" %}">
+ <a href="{% url "account:details" %}">
{% trans "Your account" context "Main navigation item" %}
</a>
</li>
diff --git a/templates/order/details.html b/templates/order/details.html
index 02503bdad0..84ece277be 100644
--- a/templates/order/details.html
+++ b/templates/order/details.html
@@ -19,7 +19,7 @@
</a>
</li>
<li>
- <a href="{% url "profile:details" %}">
+ <a href="{% url "account:details" %}">
{% trans "Your account" context "Main navigation item" %}
</a>
</li>
diff --git a/templates/order/payment.html b/templates/order/payment.html
index e1674a9b5d..137bf1f1ef 100644
--- a/templates/order/payment.html
+++ b/templates/order/payment.html
@@ -21,7 +21,7 @@
</a>
</li>
<li>
- <a href="{% url "profile:details" %}">
+ <a href="{% url "account:details" %}">
{% trans "Your account" context "Main navigation item" %}
</a>
</li>
diff --git a/templates/styleguide.html b/templates/styleguide.html
index 15040e2846..5f98cc77d5 100644
--- a/templates/styleguide.html
+++ b/templates/styleguide.html
@@ -583,7 +583,7 @@
</a>
</li>
<li>
- <a href="{% url "profile:details" %}" contenteditable="true">
+ <a href="{% url "account:details" %}" contenteditable="true">
Your profile
</a>
</li>
diff --git a/tests/conftest.py b/tests/conftest.py
index 11a0843d0a..027a0c1797 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -11,6 +11,7 @@ from django.utils.encoding import smart_text
from PIL import Image
from prices import Price
+from saleor.account.models import Address, User
from saleor.cart import utils
from saleor.cart.models import Cart
from saleor.checkout.core import Checkout
@@ -23,7 +24,6 @@ from saleor.product.models import (
ProductImage, ProductType, ProductVariant, Stock, StockLocation)
from saleor.shipping.models import ShippingMethod
from saleor.site.models import AuthorizationKey, SiteSettings
-from saleor.account.models import Address, User
@pytest.fixture(autouse=True)
diff --git a/tests/dashboard/test_staff.py b/tests/dashboard/test_staff.py
index 0afeea9d55..5b2d899910 100644
--- a/tests/dashboard/test_staff.py
+++ b/tests/dashboard/test_staff.py
@@ -6,9 +6,9 @@ from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode
from templated_email import send_templated_mail
+from saleor.account.models import User
from saleor.dashboard.staff.forms import StaffForm
from saleor.settings import DEFAULT_FROM_EMAIL
-from saleor.account.models import User
def test_staff_form_not_valid(db):
diff --git a/tests/test_checkout.py b/tests/test_checkout.py
index eb07599b3d..d931d0651a 100644
--- a/tests/test_checkout.py
+++ b/tests/test_checkout.py
@@ -6,11 +6,11 @@ from django.contrib.auth.models import AnonymousUser
from prices import Price
from satchless.item import InsufficientStock
+from saleor.account.models import Address
from saleor.checkout import views
from saleor.checkout.core import STORAGE_SESSION_KEY, Checkout
from saleor.checkout.forms import NoteForm
from saleor.shipping.models import ShippingMethodCountry
-from saleor.account.models import Address
def test_checkout_version():
diff --git a/tests/test_core.py b/tests/test_core.py
index f086cce93c..a07beb6517 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -3,6 +3,7 @@ from unittest.mock import Mock
import pytest
from django.shortcuts import reverse
+from saleor.account.models import Address, User
from saleor.core.utils import (
Country, create_superuser, get_country_by_ip, get_currency_for_country,
random_data)
@@ -10,7 +11,6 @@ from saleor.discount.models import Sale, Voucher
from saleor.order.models import Order
from saleor.product.models import Product
from saleor.shipping.models import ShippingMethod
-from saleor.account.models import Address, User
type_schema = {
'Vegetable': {
diff --git a/tests/test_elasticsearch.py b/tests/test_elasticsearch.py
index 498fd9440c..755af1f865 100644
--- a/tests/test_elasticsearch.py
+++ b/tests/test_elasticsearch.py
@@ -4,9 +4,9 @@ import pytest
from django.urls import reverse
from elasticsearch_dsl.connections import connections
+from saleor.account.models import User
from saleor.order.models import Order
from saleor.product.models import Product
-from saleor.account.models import User
MATCH_SEARCH_REQUEST = ['method', 'host', 'port', 'path']
STOREFRONT_PRODUCTS = {15, 56} # same as in recorded data!
diff --git a/tests/test_order.py b/tests/test_order.py
index 903ea50af2..e7b423c2ec 100644
--- a/tests/test_order.py
+++ b/tests/test_order.py
@@ -130,7 +130,7 @@ def test_view_connect_order_with_user_different_email(
response = authorized_client.post(url)
redirect_location = get_redirect_location(response)
- assert redirect_location == reverse('profile:details')
+ assert redirect_location == reverse('account:details')
order.refresh_from_db()
assert order.user is None
diff --git a/tests/test_postgresql_search.py b/tests/test_postgresql_search.py
index 00fc65caa9..280791bef0 100644
--- a/tests/test_postgresql_search.py
+++ b/tests/test_postgresql_search.py
@@ -3,9 +3,9 @@ from decimal import Decimal
import pytest
from django.urls import reverse
+from saleor.account.models import Address, User
from saleor.order.models import Order
from saleor.product.models import Product
-from saleor.account.models import Address, User
@pytest.fixture(scope='function', autouse=True)
diff --git a/tests/test_userprofile.py b/tests/test_userprofile.py
index 1d11f12158..9250e0d073 100644
--- a/tests/test_userprofile.py
+++ b/tests/test_userprofile.py
@@ -117,12 +117,12 @@ def test_validate_possible_number(input, exception):
def test_order_with_lines_pagination(admin_client, order_list):
settings.PAGINATE_BY = 1
data = {'page': '1'}
- url = reverse('profile:details')
+ url = reverse('account:details')
response = admin_client.get(url, data)
assert response.status_code == 200
data = {'page': '2'}
- url = reverse('profile:details')
+ url = reverse('account:details')
response = admin_client.get(url, data)
assert response.status_code == 200