Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add order count to confirm_delete
michal8567fcb0a30f
diff --git a/saleor/dashboard/staff/views.py b/saleor/dashboard/staff/views.pyindex 92dce2c82f..cefed60fb1 100644--- a/saleor/dashboard/staff/views.py+++ b/saleor/dashboard/staff/views.py@@ -5,7 +5,7 @@ from django.shortcuts import get_object_or_404, redirectfrom django.template.response import TemplateResponsefrom django.utils.translation import pgettext_lazy-from emails import send_set_password_email+from .emails import send_set_password_emailfrom .forms import StaffFormfrom ..views import superuser_requiredfrom ...core.utils import get_paginator_items@@ -57,7 +57,10 @@ def staff_create(request):@superuser_requireddef staff_delete(request, pk):- staff = get_object_or_404(User, pk=pk)+ queryset = User.objects.prefetch_related(+ 'orders')+ staff = get_object_or_404(queryset, pk=pk)+ all_orders_count = staff.orders.count()if request.method == 'POST':staff.delete()msg = pgettext_lazy(@@ -65,4 +68,5 @@ def staff_delete(request, pk):messages.success(request, msg)return redirect('dashboard:staff-list')return TemplateResponse(- request, 'dashboard/staff/modal/confirm_delete.html', {'staff': staff})+ request, 'dashboard/staff/modal/confirm_delete.html',+ {'staff': staff, 'orders': all_orders_count})diff --git a/templates/dashboard/staff/modal/confirm_delete.html b/templates/dashboard/staff/modal/confirm_delete.htmlindex 25db7ce298..be5bde9431 100644--- a/templates/dashboard/staff/modal/confirm_delete.html+++ b/templates/dashboard/staff/modal/confirm_delete.html@@ -12,8 +12,9 @@{% block content %}{% blocktrans trimmed context "Modal delete group text" %}-<p>Are you sure you want to delete staff member {{ staff }}?</p>+<p>Are you sure you want to delete staff member?</p><p>Deleting staff member also removes him from customer list and removes all his related data (orders, payment etc.).</p><p>We strongly recommend not deleting user accounts that were used for purchases (for example customer which was promoted with staff member status).</p>+<p>{{ staff }} has <strong>{{ orders }}</strong> orders.</p>{% endblocktrans %}{% endblock content %}