-
-
Notifications
You must be signed in to change notification settings - Fork 795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upgrades to admin: search_fields, list_filters and raw_id_field #1041
Conversation
for more information, see https://pre-commit.ci
This is my second take on this, I fixed the User without e-mail problem, that was in #723 |
Codecov Report
@@ Coverage Diff @@
## master #1041 +/- ##
==========================================
+ Coverage 96.62% 96.64% +0.01%
==========================================
Files 31 31
Lines 1748 1756 +8
==========================================
+ Hits 1689 1697 +8
Misses 59 59
Continue to review full report at Codecov.
|
thank you |
In hindsight, it would probably be a good thing for the Admin UI to be documented somewhere.... |
@n2ygk Which part of the Admin UI do you think should be documented. Do you mean the UI as general? Or just the search by e-mail functionality (which don't work if there is no e-mail)? |
@PetrDlouhy not here, but as an update to the Tutorial it would probably be helpful to show users around the admin UI. I'll make an issue. |
@@ -38,11 +44,15 @@ class GrantAdmin(admin.ModelAdmin): | |||
class IDTokenAdmin(admin.ModelAdmin): | |||
list_display = ("jti", "user", "application", "expires") | |||
raw_id_fields = ("user",) | |||
search_fields = ("token",) + (("user__email",) if has_email else ()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this valid? Searching from the admin now gives me django.core.exceptions.FieldError: Cannot resolve keyword 'token' into field. Choices are: access_token, application, application_id, created, expires, id, jti, scope, updated, user, user_id
@danlamanna You are right. Fixed in PR #1085 |
FWIW it might have been better to search by |
Yes, that makes sense @charettes. A PR to change this would be appreciated. |
Fixes:
Description of the Change
I defined
search_fields
,list_filters
andraw_id_fields
for easier management of the tokens in admin.Not sure what to test in this.
Also I think, this doesn't need any documentation, it is pretty self-explanatory to users.
Checklist
CHANGELOG.md
updated (only for user relevant changes)AUTHORS