Login

Snippets by AlecC

Snippet List

Paginator for PostgreSQL

Use this paginator to make admin pages load more quickly for large tables when using PostgreSQL. It uses the reltuples statistic instead of counting the rows when there is no where clause. To use this code, add the following in your admin: `class BigTableAdmin(admin.ModelAdmin): paginator = LargeTablePaginator def get_changelist(self, request, **kwargs): return LargeTableChangeList `

  • paginator
  • postgres
  • reltuples
Read More

AlecC has posted 1 snippet.