mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Use server-side pagination for more list endpoints
This commit is contained in:
parent
90feb6d210
commit
44635d2499
@ -8,6 +8,7 @@ from __future__ import unicode_literals
|
||||
from django_filters.rest_framework import DjangoFilterBackend
|
||||
from rest_framework import filters
|
||||
from rest_framework import generics
|
||||
from rest_framework.pagination import LimitOffsetPagination
|
||||
|
||||
from django.conf.urls import url, include
|
||||
from django.db.models import Q
|
||||
@ -32,6 +33,7 @@ class CompanyList(generics.ListCreateAPIView):
|
||||
|
||||
serializer_class = CompanySerializer
|
||||
queryset = Company.objects.all()
|
||||
pagination_class = LimitOffsetPagination
|
||||
|
||||
def get_queryset(self):
|
||||
|
||||
|
@ -22,7 +22,7 @@ InvenTree | {% trans "Supplier List" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<table class='table table-striped' id='company-table' data-toolbar='#button-toolbar'>
|
||||
<table class='table table-striped table-condensed' id='company-table' data-toolbar='#button-toolbar'>
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -8,6 +8,7 @@ from __future__ import unicode_literals
|
||||
from django_filters.rest_framework import DjangoFilterBackend
|
||||
from rest_framework import generics
|
||||
from rest_framework import filters
|
||||
from rest_framework.pagination import LimitOffsetPagination
|
||||
|
||||
from django.conf.urls import url, include
|
||||
|
||||
@ -36,6 +37,7 @@ class POList(generics.ListCreateAPIView):
|
||||
|
||||
queryset = PurchaseOrder.objects.all()
|
||||
serializer_class = POSerializer
|
||||
pagination_class = LimitOffsetPagination
|
||||
|
||||
def get_serializer(self, *args, **kwargs):
|
||||
|
||||
@ -238,6 +240,7 @@ class SOList(generics.ListCreateAPIView):
|
||||
|
||||
queryset = SalesOrder.objects.all()
|
||||
serializer_class = SalesOrderSerializer
|
||||
pagination_class = LimitOffsetPagination
|
||||
|
||||
def get_serializer(self, *args, **kwargs):
|
||||
|
||||
|
@ -93,6 +93,7 @@ function loadCompanyTable(table, url, options={}) {
|
||||
method: 'get',
|
||||
queryParams: filters,
|
||||
groupBy: false,
|
||||
sidePagination: 'server',
|
||||
formatNoMatches: function() { return "{% trans "No company information found" %}"; },
|
||||
showColumns: true,
|
||||
name: options.pagetype || 'company',
|
||||
|
@ -131,6 +131,7 @@ function loadPurchaseOrderTable(table, options) {
|
||||
queryParams: filters,
|
||||
name: 'purchaseorder',
|
||||
groupBy: false,
|
||||
sidePagination: 'server',
|
||||
original: options.params,
|
||||
formatNoMatches: function() { return '{% trans "No purchase orders found" %}'; },
|
||||
columns: [
|
||||
@ -225,6 +226,7 @@ function loadSalesOrderTable(table, options) {
|
||||
queryParams: filters,
|
||||
name: 'salesorder',
|
||||
groupBy: false,
|
||||
sidePagination: 'server',
|
||||
original: options.params,
|
||||
formatNoMatches: function() { return '{% trans "No sales orders found" %}'; },
|
||||
columns: [
|
||||
|
Loading…
Reference in New Issue
Block a user