Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Paginate results on dashboard homepage backend
Anna Siwik959509feae64
diff --git a/saleor/dashboard/views.py b/saleor/dashboard/views.pyindex 03fe2c46db..c54710477d 100644--- a/saleor/dashboard/views.py+++ b/saleor/dashboard/views.py@@ -34,6 +34,7 @@ def superuser_required(view_func=None, redirect_field_name=REDIRECT_FIELD_NAME,@staff_member_requireddef index(request):+ INDEX_PAGINATE_BY = 10orders_to_ship = Order.objects.select_related('user').prefetch_related('groups', 'groups__lines', 'payments')orders_to_ship = [@@ -43,9 +44,10 @@ def index(request):status=PaymentStatus.PREAUTH).order_by('-created')payments = payments.select_related('order', 'order__user')low_stock = get_low_stock_products()- ctx = {'preauthorized_payments': payments,- 'orders_to_ship': orders_to_ship,- 'low_stock': low_stock}+ ctx = {'preauthorized_payments': payments[:INDEX_PAGINATE_BY],+ 'orders_to_ship': orders_to_ship[:INDEX_PAGINATE_BY],+ 'low_stock': low_stock[:INDEX_PAGINATE_BY],+ 'index_paginate_by': INDEX_PAGINATE_BY}return TemplateResponse(request, 'dashboard/index.html', ctx)