This repository has been archived by the owner on Jul 26, 2024. It is now read-only.
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.
Rationale for this pull request
As of v1.2.1:
Both issue are nicely solved by using a specific permission (
clearcache.use_clearcache
), to control the access to both the service and the display its section in the Admin's homepage.Testing for the permission in the existing
test_func()
of the view preserves the current behaviour as long as the permission is not granted to anyone, since superusers have all permissions.Changes summary
CustomPermissions
” (without databasse tables) to createclearcache.use_clearcache
permission, and made migration.ClearCacheAdminView.test_func()
to test for the permission (this is backward compatible with the previous test of “is_superuser”, since superusers have all permissions).admin/index.html
template, to avoid displaying the clearcache section on Admin’s homepage if the user is not authorized.tests
folder.test_superuser.py
. Just moved CACHE_EXPIRE_IN_SEC constant at module level to avoid PEP8 violation (all-caps constants not supposed to be in functions).test_regular_user.py
.tox.ini
as required by “Missing dependency” tox warning.workflow_dispatch:
event to be able to manually trigger the workflow. It could be removed, but I guess it doesn't hurt.All tests are ok.