Feat/add flush expired tokens command to admin#721
Open
joris97jansen wants to merge 5 commits intojazzband:masterfrom
Open
Feat/add flush expired tokens command to admin#721joris97jansen wants to merge 5 commits intojazzband:masterfrom
joris97jansen wants to merge 5 commits intojazzband:masterfrom
Conversation
Author
|
@Andrew-Chen-Wang Ready for review. |
2ykwang
reviewed
Jul 5, 2023
| ordering = ("token__user",) | ||
| actions = ["flush_expired_tokens"] | ||
|
|
||
| def flush_expired_tokens(self, request, queryset): |
Member
There was a problem hiding this comment.
Suggested change
| def flush_expired_tokens(self, request, queryset): | |
| @admin.action(permissions=["change"], description = _("Flush expired tokens")) | |
| def flush_expired_tokens(self, request, queryset): |
What are your thoughts on using the @admin.action decorator?
It allows you to set the required permissions for executing an action and provides a description for it as well. Additionally, you can use gettext_lazy to provide localization support. @tpotjj
Member
|
Can you please execute the 'makemessages' command to generate the 'po' file? @tpotjj |
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.
Doing this as a cronjob might be the better way of doing it, but for a smaller project that doesn't allow setting up a cronjob or because of the lack of knowledge, it might be convenient to add this to the Admin.