django-admin-wizard


Namedjango-admin-wizard JSON
Version 0.5.1 PyPI version JSON
download
home_pageNone
SummaryDjango Admin dialogs and actions with intermediate forms
upload_time2024-03-26 13:27:35
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT
keywords django admin wizard actions
VCS
bugtrack_url
requirements Django django-admin-smoke
Travis-CI No Travis.
coveralls test coverage No coveralls.
            django-admin-wizard
===================


django-admin-wizard is a Django app providing helpers for django admin actions
with intermediate forms.

[![Build Status](https://github.com/just-work/django-admin-wizard/workflows/build/badge.svg?branch=master&event=push)](https://github.com/just-work/django-admin-wizard/actions?query=event%3Apush+branch%3Amaster+workflow%3Abuild)
[![codecov](https://codecov.io/gh/just-work/django-admin-wizard/branch/master/graph/badge.svg)](https://codecov.io/gh/just-work/django-admin-wizard)
[![PyPI version](https://badge.fury.io/py/django-admin-wizard.svg)](https://badge.fury.io/py/django-admin-wizard)

Description
-----------

Do you know "delete selected" action in Django-admin? This package provides 
helpers for creating such actions with intermediate forms in two lines of code.
Also, you may add a link from django admin change page to a custom form view to
perform some form-supplied action on single object.

Installation
------------

```shell script
pip install django-admin-wizard
```

Working example is in `testproject.testapp`.

1. Add application to installed apps in django settings:
    ```python
    INSTALLED_APPS.append('admin_wizard')
    ```
2. And an action to your admin:
    ```python
    from django.contrib import admin
    from admin_wizard.admin import UpdateAction
    
    from testproject.testapp import forms, models
   
   
    @admin.register(models.MyModel)
    class MyModelAdmin(admin.ModelAdmin):
        actions = [UpdateAction(form_class=forms.RenameForm)]
    ```
3. Add custom view to your admin:
    ```python
    from django.contrib import admin
    from django.urls import path
    from admin_wizard.admin import UpdateDialog
    
    from testproject.testapp import forms, models
   
   
    @admin.register(models.MyModel)
    class MyModelAdmin(admin.ModelAdmin):
   
        def get_urls(self):
            urls = [
                path('<int:pk>/rename/',
                     UpdateDialog.as_view(model_admin=self,
                                          model=models.MyModel,
                                          form_class=forms.RenameForm),
                     name='rename')
            ]
            return urls + super().get_urls()

    ```
4. Add a link to custom dialog in admin change page:
    ```python
    from django.contrib import admin
    from django.urls import reverse
    
    from testproject.testapp import models
   
  
    @admin.register(models.MyModel)
    class MyModelAdmin(admin.ModelAdmin):
       readonly_fields = ('update_obj_url',)
   
       def update_obj_url(self, obj):
           # FIXME: it's XSS, don't copy-paste
           url = reverse('admin:rename', kwargs=dict(pk=obj.pk))
           return f'<a href="{url}">Rename...</a>'
       update_obj_url.short_description = 'rename'
    ```

Now you have "rename" action in changelist and "rename" link in change view.
Enjoy :)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "django-admin-wizard",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "django, admin, wizard, actions",
    "author": null,
    "author_email": "Sergey Tikhonov <zimbler@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/6a/79/fe31432db2125ba7fdb980c466f87e7ca71b45a4cf5274928cacd5194456/django-admin-wizard-0.5.1.tar.gz",
    "platform": null,
    "description": "django-admin-wizard\n===================\n\n\ndjango-admin-wizard is a Django app providing helpers for django admin actions\nwith intermediate forms.\n\n[![Build Status](https://github.com/just-work/django-admin-wizard/workflows/build/badge.svg?branch=master&event=push)](https://github.com/just-work/django-admin-wizard/actions?query=event%3Apush+branch%3Amaster+workflow%3Abuild)\n[![codecov](https://codecov.io/gh/just-work/django-admin-wizard/branch/master/graph/badge.svg)](https://codecov.io/gh/just-work/django-admin-wizard)\n[![PyPI version](https://badge.fury.io/py/django-admin-wizard.svg)](https://badge.fury.io/py/django-admin-wizard)\n\nDescription\n-----------\n\nDo you know \"delete selected\" action in Django-admin? This package provides \nhelpers for creating such actions with intermediate forms in two lines of code.\nAlso, you may add a link from django admin change page to a custom form view to\nperform some form-supplied action on single object.\n\nInstallation\n------------\n\n```shell script\npip install django-admin-wizard\n```\n\nWorking example is in `testproject.testapp`.\n\n1. Add application to installed apps in django settings:\n    ```python\n    INSTALLED_APPS.append('admin_wizard')\n    ```\n2. And an action to your admin:\n    ```python\n    from django.contrib import admin\n    from admin_wizard.admin import UpdateAction\n    \n    from testproject.testapp import forms, models\n   \n   \n    @admin.register(models.MyModel)\n    class MyModelAdmin(admin.ModelAdmin):\n        actions = [UpdateAction(form_class=forms.RenameForm)]\n    ```\n3. Add custom view to your admin:\n    ```python\n    from django.contrib import admin\n    from django.urls import path\n    from admin_wizard.admin import UpdateDialog\n    \n    from testproject.testapp import forms, models\n   \n   \n    @admin.register(models.MyModel)\n    class MyModelAdmin(admin.ModelAdmin):\n   \n        def get_urls(self):\n            urls = [\n                path('<int:pk>/rename/',\n                     UpdateDialog.as_view(model_admin=self,\n                                          model=models.MyModel,\n                                          form_class=forms.RenameForm),\n                     name='rename')\n            ]\n            return urls + super().get_urls()\n\n    ```\n4. Add a link to custom dialog in admin change page:\n    ```python\n    from django.contrib import admin\n    from django.urls import reverse\n    \n    from testproject.testapp import models\n   \n  \n    @admin.register(models.MyModel)\n    class MyModelAdmin(admin.ModelAdmin):\n       readonly_fields = ('update_obj_url',)\n   \n       def update_obj_url(self, obj):\n           # FIXME: it's XSS, don't copy-paste\n           url = reverse('admin:rename', kwargs=dict(pk=obj.pk))\n           return f'<a href=\"{url}\">Rename...</a>'\n       update_obj_url.short_description = 'rename'\n    ```\n\nNow you have \"rename\" action in changelist and \"rename\" link in change view.\nEnjoy :)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Django Admin dialogs and actions with intermediate forms",
    "version": "0.5.1",
    "project_urls": {
        "homepage": "https://github.com/just-work/django-admin-wizard"
    },
    "split_keywords": [
        "django",
        " admin",
        " wizard",
        " actions"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0e84f0bbdc6db861ee399269312cc285df86a4da9d53f2e0018f6d637193387d",
                "md5": "73a343d84a4a5bf505df8f671bb2473c",
                "sha256": "588917e14bebf8d4ae596fc28720924f714418d8342cdb530f98135a6a760b15"
            },
            "downloads": -1,
            "filename": "django_admin_wizard-0.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "73a343d84a4a5bf505df8f671bb2473c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8304,
            "upload_time": "2024-03-26T13:27:34",
            "upload_time_iso_8601": "2024-03-26T13:27:34.384145Z",
            "url": "https://files.pythonhosted.org/packages/0e/84/f0bbdc6db861ee399269312cc285df86a4da9d53f2e0018f6d637193387d/django_admin_wizard-0.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6a79fe31432db2125ba7fdb980c466f87e7ca71b45a4cf5274928cacd5194456",
                "md5": "5b382da80eeef4285abb61f8593285d4",
                "sha256": "7ba24c129268b531e4818890542154d380b3ced2cead8419aa3c908df7cf632a"
            },
            "downloads": -1,
            "filename": "django-admin-wizard-0.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "5b382da80eeef4285abb61f8593285d4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7764,
            "upload_time": "2024-03-26T13:27:35",
            "upload_time_iso_8601": "2024-03-26T13:27:35.944177Z",
            "url": "https://files.pythonhosted.org/packages/6a/79/fe31432db2125ba7fdb980c466f87e7ca71b45a4cf5274928cacd5194456/django-admin-wizard-0.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-26 13:27:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "just-work",
    "github_project": "django-admin-wizard",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "Django",
            "specs": [
                [
                    "==",
                    "5.0.3"
                ]
            ]
        },
        {
            "name": "django-admin-smoke",
            "specs": [
                [
                    "==",
                    "0.5.0"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "django-admin-wizard"
}
        
Elapsed time: 2.82311s