Reputation: 11561
I want to visualize a big, indexed table - big enough for count(*)
to be too slow for my use case. Here's my views.py code:
import django_tables2
from projectname.models import Growth
def dashboard(request):
class StatisticsTable(django_tables2.Table):
class Meta:
model = Growth
table = StatisticsTable(Growth.objects.all())
django_tables2.RequestConfig(
request
).configure(table)
return render(request, "plain_table.html", {'table': table,
'title': 'Growth dashboard',
'search': None})
I was looking for examples on how to use django_tables2.paginators.LazyPaginator
here and so far only found that I should pass it as a paginate=
in django_tables2.RequestConfig
, but I still get a regular paginator if I pass a reference to the class there. What's the proper use of this class in this context?
Upvotes: 0
Views: 700
Reputation: 4229
RequestConfig(paginate={"paginator_class": LazyPaginator}).configure(table)
Upvotes: 1