Skip to content

Conversation

@aclark4life
Copy link
Owner

@aclark4life aclark4life commented Nov 12, 2025

Existing approaches to "no count" pagination do not seem to include support for pagination in the Django admin, so:

  • Subclass Django's core Paginator

    • override count
  • Subclass Django's contrib admin view ChangeList.get_results

    • Use len instead of count
    • Ruff fixes for try/except
  • Subclass Django's contrib ModelAdmin

    • override get_paginator
    • override get_changelist

Existing approaches to "no count" pagination do not seem to include
support for pagination in the Django admin, so:

- Subclass Django's core Paginator
  - override count

- Subclass Django's contrib admin view ChangeList.get_results
  - Use len instead of count
  - Ruff fixes for try/except

- Subclass Django's contrib ModelAdmin
  - override get_paginator
  - override get_changelist
@timgraham
Copy link

As I said before, len(queryset) will load the entire collection into memory. If MongoDB is supposed to be for big data, this is a nogo. It will likely take a long time and/or cause the app server to run out of memory.

Perhaps it works for testing a toy project with a small collection, but I'm unsure we should ship this approach to enterprise customers. We can check with the team before investing more time, like adding tests.

@aclark4life
Copy link
Owner Author

As I said before, len(queryset) will load the entire collection into memory. If MongoDB is supposed to be for big data, this is a nogo. It will likely take a long time and/or cause the app server to run out of memory.

Perhaps it works for testing a toy project with a small collection, but I'm unsure we should ship this approach to enterprise customers. We can check with the team before investing more time, like adding tests.

We should not ship a toy to the enterprise but we should figure out how to implement this feature so folks can use the Django admin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants