=====================
django-adminutilities
=====================
.. image:: https://img.shields.io/pypi/v/adminutilities.svg
:target: https://pypi.python.org/pypi/adminutilities
.. image:: https://img.shields.io/travis/Skylor-Tang/adminutilities.svg
:target: https://travis-ci.com/Skylor-Tang/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
------------
1. Install the package via pip:
.. code-block:: bash
pip install django-adminutilities
2. Add `adminutilities` to your `INSTALLED_APPS` setting like this:
.. code-block:: python
INSTALLED_APPS = [
...
'adminutilities',
]
3. Add `adminutilities.middleware.GetAllAdminToolFunctionsMiddleware` to your `MIDDLEWARE` setting like this:
.. code-block:: python
MIDDLEWARE = [
...
'adminutilities.middleware.GetAllAdminToolFunctionsMiddleware',
]
4. Add `adminutilities` to your `urls.py`:
.. code-block:: python
urlpatterns = [
...
path('admin/', admin.site.urls),
path('admin/adminutilities/', include('adminutilities.urls')),
]
Usage
-----
1. Create a new file `admin_tools.py` in your app folder, and define your custom functions, for example:
.. code-block:: python
from adminutilities.decorators import admin_tool
@admin_tool
def my_custom_function():
return 'Hello, world!'
2. 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.
3. 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:
.. code-block:: bash
python manage.py adminutilities main.my_custom_function
Credits
-------
This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
=======
History
=======
0.1.0 (2024-03-17)
------------------
* First release on PyPI.
Raw data
{
"_id": null,
"home_page": "https://github.com/Skylor-Tang/adminutilities",
"name": "adminutilities",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "adminutilities",
"author": "tangmeijian",
"author_email": "tang1996mei@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4d/d7/6ab104ffd7ad900fc2b78f6aee883faf20c1ed00f3fbed9384300e4cccfc/adminutilities-0.1.0.tar.gz",
"platform": null,
"description": "=====================\ndjango-adminutilities\n=====================\n\n\n.. image:: https://img.shields.io/pypi/v/adminutilities.svg\n :target: https://pypi.python.org/pypi/adminutilities\n\n.. image:: https://img.shields.io/travis/Skylor-Tang/adminutilities.svg\n :target: https://travis-ci.com/Skylor-Tang/adminutilities\n\n\nAllow calling registered custom functions (system tools, script functions, etc.) via admin UI or `manage.py` command.\n\nThe inspiration for this library comes from `https://github.com/timonweb/django-clearcache`.\n\nInstallation\n------------\n\n1. Install the package via pip:\n\n .. code-block:: bash\n\n pip install django-adminutilities\n\n2. Add `adminutilities` to your `INSTALLED_APPS` setting like this:\n\n .. code-block:: python\n\n INSTALLED_APPS = [\n ...\n 'adminutilities',\n ]\n\n3. Add `adminutilities.middleware.GetAllAdminToolFunctionsMiddleware` to your `MIDDLEWARE` setting like this:\n\n .. code-block:: python\n\n MIDDLEWARE = [\n ...\n 'adminutilities.middleware.GetAllAdminToolFunctionsMiddleware',\n ]\n\n4. Add `adminutilities` to your `urls.py`:\n\n .. code-block:: python\n\n urlpatterns = [\n ...\n path('admin/', admin.site.urls),\n path('admin/adminutilities/', include('adminutilities.urls')),\n ]\n\nUsage\n-----\n\n1. Create a new file `admin_tools.py` in your app folder, and define your custom functions, for example:\n\n .. code-block:: python\n\n from adminutilities.decorators import admin_tool\n\n @admin_tool\n def my_custom_function():\n return 'Hello, world!'\n\n2. 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.\n\n3. 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:\n\n .. code-block:: bash\n\n python manage.py adminutilities main.my_custom_function\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n\n\n=======\nHistory\n=======\n\n0.1.0 (2024-03-17)\n------------------\n\n* First release on PyPI.\n",
"bugtrack_url": null,
"license": "BSD license",
"summary": "Allow calling registered custom functions (system tools, script functions, etc.) via admin UI or manage.py command.",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/Skylor-Tang/adminutilities"
},
"split_keywords": [
"adminutilities"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "931105ffc1f97d954183ef115b2a982f71ebde2545d2dd460498bb1580f56d8e",
"md5": "7a7b3dd4c313583220d68be2689c38b4",
"sha256": "fd9bb8f8d531c3f37105103fd85890176042a3ef194271f0193c2e8618c56b5f"
},
"downloads": -1,
"filename": "adminutilities-0.1.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "7a7b3dd4c313583220d68be2689c38b4",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6",
"size": 9146,
"upload_time": "2024-03-18T02:39:24",
"upload_time_iso_8601": "2024-03-18T02:39:24.517032Z",
"url": "https://files.pythonhosted.org/packages/93/11/05ffc1f97d954183ef115b2a982f71ebde2545d2dd460498bb1580f56d8e/adminutilities-0.1.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4dd76ab104ffd7ad900fc2b78f6aee883faf20c1ed00f3fbed9384300e4cccfc",
"md5": "5d09efe6092a38e903225d1e3cb8775c",
"sha256": "be67a8f011191b807d5cbc9bfc0207f9f74e2b8314b8ca208c82e4aee5f573fb"
},
"downloads": -1,
"filename": "adminutilities-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "5d09efe6092a38e903225d1e3cb8775c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 13501,
"upload_time": "2024-03-18T02:39:26",
"upload_time_iso_8601": "2024-03-18T02:39:26.747906Z",
"url": "https://files.pythonhosted.org/packages/4d/d7/6ab104ffd7ad900fc2b78f6aee883faf20c1ed00f3fbed9384300e4cccfc/adminutilities-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-18 02:39:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Skylor-Tang",
"github_project": "adminutilities",
"github_not_found": true,
"lcname": "adminutilities"
}