Improve Django Admin contract list usability#446
Open
kingksjo wants to merge 1 commit intoSoroScan:mainfrom
Open
Improve Django Admin contract list usability#446kingksjo wants to merge 1 commit intoSoroScan:mainfrom
kingksjo wants to merge 1 commit intoSoroScan:mainfrom
Conversation
- Adds db_index=True to TrackedContract.name for efficient ORDER BY name in the admin list (was hitting a seq scan at 100+ contracts) - Adds db_index=True to TrackedContract.created_at for efficient ORDER BY -created_at, the default admin ordering on every page load - Adds migration 0039 (reversible AlterField operations, no data loss) Admin search, filters, and ordering were already implemented and passing all 27 tests in test_admin_contract_list.py — this PR completes the work by closing the remaining DB performance gap for sort operations. Closes SoroScan#277
|
@kingksjo Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improve Django Admin Contract List Usability
Description
This PR improves the usability and performance of the Django Admin contract list view. While the search, filter, and ordering configurations were already present, this PR adds the necessary database indexes to ensure these operations remain performant as the number of contracts grows (100+).
Key Changes
db_index=TruetoTrackedContract.nameandTrackedContract.created_at.namenow uses an index scan.created_at(the default admin ordering) now uses an index scan.0039to apply these index changes.Related Issues
Closes #316
Verification Steps
Test Results
Visual Verification (Manual)
is_activeandnetworkare present and functional in the sidebar.created_atandnameis active and performant.