Add pagination to order list in dashboard
This commit is contained in:
parent
020819b1a9
commit
0c9af1a7fa
@ -28,5 +28,24 @@
|
||||
<span class="object__item">No orders</span>
|
||||
{% endfor %}
|
||||
</section>
|
||||
<section>
|
||||
<div class="pagination">
|
||||
<p class="step-links">
|
||||
{% if page_obj.has_previous %}
|
||||
<a href="?page=1">« first</a>
|
||||
<a href="?page={{ page_obj.previous_page_number }}">previous</a>
|
||||
{% endif %}
|
||||
|
||||
<span class="current">
|
||||
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}.
|
||||
</span>
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
<a href="?page={{ page_obj.next_page_number }}">next</a>
|
||||
<a href="?page={{ page_obj.paginator.num_pages }}">last »</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
{% endblock content %}
|
||||
|
||||
@ -134,6 +134,7 @@ class CouponDeleteView(LoginRequiredMixin, SuccessMessageMixin, DeleteView):
|
||||
class OrderListView(LoginRequiredMixin, ListView):
|
||||
model = Order
|
||||
template_name = 'dashboard/order_list.html'
|
||||
paginate_by = 50
|
||||
|
||||
def get_queryset(self):
|
||||
query = self.request.GET.get('status')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user