Skip to content

Commit

Permalink
feat: paginate customers
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Dec 18, 2024
1 parent 25d79a5 commit d19bee6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions weblate_web/crm/templates/payments/customer_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,19 @@
{% endfor %}
</table>
</section>
<div class="pagination">
<span 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 %}
</span>
</div>
{% endblock %}
1 change: 1 addition & 0 deletions weblate_web/crm/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class CustomerListView(CRMMixin, ListView):
model = Customer
permission = "payments.view_customer"
title = "Customers"
paginate_by = 100

def get_queryset(self):
return super().get_queryset().order_by("name")
Expand Down

0 comments on commit d19bee6

Please sign in to comment.