django-adminutilities


Namedjango-adminutilities JSON
Version 0.1.6 PyPI version JSON
download
home_pagehttps://github.com/Skylor-Tang/django-adminutilities
SummaryAllow calling registered custom functions (system tools, script functions, etc.) via admin UI or manage.py command.
upload_time2024-03-18 05:19:44
maintainer
docs_urlNone
authortangmeijian
requires_python>=3.6
licenseBSD license
keywords django utilities admin
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =====================
django-adminutilities
=====================


.. image:: https://img.shields.io/pypi/v/django-adminutilities.svg
    :target: https://pypi.python.org/pypi/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, make sure it's above `django.contrib.admin` like this:

    .. code-block:: python

        INSTALLED_APPS = [
             ...
             'django.contrib.admin',
             '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/django-adminutilities",
    "name": "django-adminutilities",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "django,utilities,admin",
    "author": "tangmeijian",
    "author_email": "tang1996mei@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ac/fe/d3c04f0fdf36214f5232ff37936ade7eda4b0bc99f588ec6c8897e28619a/django-adminutilities-0.1.6.tar.gz",
    "platform": null,
    "description": "=====================\ndjango-adminutilities\n=====================\n\n\n.. image:: https://img.shields.io/pypi/v/django-adminutilities.svg\n    :target: https://pypi.python.org/pypi/django-adminutilities\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, make sure it's above `django.contrib.admin` like this:\n\n    .. code-block:: python\n\n        INSTALLED_APPS = [\n             ...\n             'django.contrib.admin',\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.6",
    "project_urls": {
        "Homepage": "https://github.com/Skylor-Tang/django-adminutilities"
    },
    "split_keywords": [
        "django",
        "utilities",
        "admin"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eff973b221258e6c2cdbb553676108ec6f442e86dcc40fd075317af0a17770d1",
                "md5": "8f0b300f9372611250fbf4491a931fc6",
                "sha256": "de0d2c937d1248c895040571c6dcfcfece873457102c3f5391bcb1c1e2448592"
            },
            "downloads": -1,
            "filename": "django_adminutilities-0.1.6-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8f0b300f9372611250fbf4491a931fc6",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 10701,
            "upload_time": "2024-03-18T05:19:42",
            "upload_time_iso_8601": "2024-03-18T05:19:42.154200Z",
            "url": "https://files.pythonhosted.org/packages/ef/f9/73b221258e6c2cdbb553676108ec6f442e86dcc40fd075317af0a17770d1/django_adminutilities-0.1.6-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "acfed3c04f0fdf36214f5232ff37936ade7eda4b0bc99f588ec6c8897e28619a",
                "md5": "284570cd23bb635790950554e56a3f03",
                "sha256": "21d0622a6d05e63fd10d424e1bc9841821aa3f92dfa60d483084ffe6a95c49fd"
            },
            "downloads": -1,
            "filename": "django-adminutilities-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "284570cd23bb635790950554e56a3f03",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 14795,
            "upload_time": "2024-03-18T05:19:44",
            "upload_time_iso_8601": "2024-03-18T05:19:44.037413Z",
            "url": "https://files.pythonhosted.org/packages/ac/fe/d3c04f0fdf36214f5232ff37936ade7eda4b0bc99f588ec6c8897e28619a/django-adminutilities-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-18 05:19:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Skylor-Tang",
    "github_project": "django-adminutilities",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "django-adminutilities"
}
        
Elapsed time: 0.20258s