Metadata-Version: 2.1
Name: django-adminutilities
Version: 0.1.2
Summary: Allow calling registered custom functions (system tools, script functions, etc.)  via admin UI or manage.py command.
Home-page: https://github.com/Skylor-Tang/django-adminutilities
Author: tangmeijian
Author-email: tang1996mei@gmail.com
License: BSD license
Keywords: django,utilities,admin
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.6
License-File: LICENSE
License-File: AUTHORS.rst

=====================
django-adminutilities
=====================


.. image:: https://img.shields.io/pypi/v/django-adminutilities.svg
    :target: https://pypi.python.org/pypi/django-adminutilities

.. image:: https://img.shields.io/travis/Skylor-Tang/django-adminutilities.svg
    :target: https://travis-ci.com/Skylor-Tang/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
------------

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.
