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 django_filters.rest_framework import DjangoFilterBackend
|
||||||
from rest_framework import filters
|
from rest_framework import filters
|
||||||
from rest_framework import generics
|
from rest_framework import generics
|
||||||
|
from rest_framework.pagination import LimitOffsetPagination
|
||||||
|
|
||||||
from django.conf.urls import url, include
|
from django.conf.urls import url, include
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
@ -32,6 +33,7 @@ class CompanyList(generics.ListCreateAPIView):
|
|||||||
|
|
||||||
serializer_class = CompanySerializer
|
serializer_class = CompanySerializer
|
||||||
queryset = Company.objects.all()
|
queryset = Company.objects.all()
|
||||||
|
pagination_class = LimitOffsetPagination
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ InvenTree | {% trans "Supplier List" %}
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% 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>
|
</table>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -8,6 +8,7 @@ from __future__ import unicode_literals
|
|||||||
from django_filters.rest_framework import DjangoFilterBackend
|
from django_filters.rest_framework import DjangoFilterBackend
|
||||||
from rest_framework import generics
|
from rest_framework import generics
|
||||||
from rest_framework import filters
|
from rest_framework import filters
|
||||||
|
from rest_framework.pagination import LimitOffsetPagination
|
||||||
|
|
||||||
from django.conf.urls import url, include
|
from django.conf.urls import url, include
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ class POList(generics.ListCreateAPIView):
|
|||||||
|
|
||||||
queryset = PurchaseOrder.objects.all()
|
queryset = PurchaseOrder.objects.all()
|
||||||
serializer_class = POSerializer
|
serializer_class = POSerializer
|
||||||
|
pagination_class = LimitOffsetPagination
|
||||||
|
|
||||||
def get_serializer(self, *args, **kwargs):
|
def get_serializer(self, *args, **kwargs):
|
||||||
|
|
||||||
@ -238,6 +240,7 @@ class SOList(generics.ListCreateAPIView):
|
|||||||
|
|
||||||
queryset = SalesOrder.objects.all()
|
queryset = SalesOrder.objects.all()
|
||||||
serializer_class = SalesOrderSerializer
|
serializer_class = SalesOrderSerializer
|
||||||
|
pagination_class = LimitOffsetPagination
|
||||||
|
|
||||||
def get_serializer(self, *args, **kwargs):
|
def get_serializer(self, *args, **kwargs):
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@ function loadCompanyTable(table, url, options={}) {
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
queryParams: filters,
|
queryParams: filters,
|
||||||
groupBy: false,
|
groupBy: false,
|
||||||
|
sidePagination: 'server',
|
||||||
formatNoMatches: function() { return "{% trans "No company information found" %}"; },
|
formatNoMatches: function() { return "{% trans "No company information found" %}"; },
|
||||||
showColumns: true,
|
showColumns: true,
|
||||||
name: options.pagetype || 'company',
|
name: options.pagetype || 'company',
|
||||||
|
@ -131,6 +131,7 @@ function loadPurchaseOrderTable(table, options) {
|
|||||||
queryParams: filters,
|
queryParams: filters,
|
||||||
name: 'purchaseorder',
|
name: 'purchaseorder',
|
||||||
groupBy: false,
|
groupBy: false,
|
||||||
|
sidePagination: 'server',
|
||||||
original: options.params,
|
original: options.params,
|
||||||
formatNoMatches: function() { return '{% trans "No purchase orders found" %}'; },
|
formatNoMatches: function() { return '{% trans "No purchase orders found" %}'; },
|
||||||
columns: [
|
columns: [
|
||||||
@ -225,6 +226,7 @@ function loadSalesOrderTable(table, options) {
|
|||||||
queryParams: filters,
|
queryParams: filters,
|
||||||
name: 'salesorder',
|
name: 'salesorder',
|
||||||
groupBy: false,
|
groupBy: false,
|
||||||
|
sidePagination: 'server',
|
||||||
original: options.params,
|
original: options.params,
|
||||||
formatNoMatches: function() { return '{% trans "No sales orders found" %}'; },
|
formatNoMatches: function() { return '{% trans "No sales orders found" %}'; },
|
||||||
columns: [
|
columns: [
|
||||||
|
Loading…
Reference in New Issue
Block a user