Allow calling registered custom functions (system tools, script functions, etc.) via admin UI or manage.py command.
Project description
django-adminutilities
Allow calling registered custom functions (system tools, script functions, etc.) via admin UI or manage.py command.
The inspiration for this library comes from https://github.com/timonweb/django-clearcache.
Installation
Install the package via pip:
pip install django-adminutilities
Add adminutilities to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'adminutilities', ]
Add adminutilities.middleware.GetAllAdminToolFunctionsMiddleware to your MIDDLEWARE setting like this:
MIDDLEWARE = [ ... 'adminutilities.middleware.GetAllAdminToolFunctionsMiddleware', ]
Add adminutilities to your urls.py:
urlpatterns = [ ... path('admin/', admin.site.urls), path('admin/adminutilities/', include('adminutilities.urls')), ]
Usage
Create a new file admin_tools.py in your app folder, and define your custom functions, for example:
from adminutilities.decorators import admin_tool @admin_tool def my_custom_function(): return 'Hello, world!'
Go to /admin/adminutilities/ and you will see the registered functions. If you click the function, it will execute the function and show the result.
You can also call the function via manage.py command, need to provide the full path of the function (app_name.function_name), for example:
python manage.py adminutilities main.my_custom_function
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2024-03-17)
First release on PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-adminutilities-0.1.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35d723610d836a5eb68ada1f9a2db9b7be7d8252578a128b1a75a16dae92103a |
|
MD5 | 014334ab03107fdb5980c6853177def8 |
|
BLAKE2b-256 | 617bee163f76f3df19766a628debe315ee624053904cd8e114ece5841fe9d78a |
Hashes for django_adminutilities-0.1.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5d28d6bc94b34052abb2ea85de67b7ed500c85d5a78969cbeed93dde3d88d01 |
|
MD5 | 4b1dff8c47c8d7c19e215c1b9fb60814 |
|
BLAKE2b-256 | 2a56ca71d6054da375d2756be992802bcc4aac6749a58bc81e05121167bfbe51 |