{"id":16417379,"url":"https://github.com/TrangPham/django-admin-confirm","last_synced_at":"2025-10-26T20:30:26.529Z","repository":{"id":40456615,"uuid":"311132778","full_name":"TrangPham/django-admin-confirm","owner":"TrangPham","description":"AdminConfirmMixin is a mixin for ModelAdmin that adds confirmations to changes, additions and actions.","archived":false,"fork":false,"pushed_at":"2024-08-20T04:45:43.000Z","size":5864,"stargazers_count":132,"open_issues_count":17,"forks_count":16,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-05T06:02:53.160Z","etag":null,"topics":["django-admin"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TrangPham.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-08T18:56:53.000Z","updated_at":"2025-01-29T10:35:10.000Z","dependencies_parsed_at":"2024-04-17T09:31:28.666Z","dependency_job_id":null,"html_url":"https://github.com/TrangPham/django-admin-confirm","commit_stats":{"total_commits":68,"total_committers":7,"mean_commits":9.714285714285714,"dds":0.5147058823529411,"last_synced_commit":"76e96c30b3f800b86a498519176e654c9db85a88"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrangPham%2Fdjango-admin-confirm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrangPham%2Fdjango-admin-confirm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrangPham%2Fdjango-admin-confirm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrangPham%2Fdjango-admin-confirm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TrangPham","download_url":"https://codeload.github.com/TrangPham/django-admin-confirm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238394323,"owners_count":19464583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django-admin"],"created_at":"2024-10-11T07:11:28.641Z","updated_at":"2025-10-26T20:30:26.524Z","avatar_url":"https://github.com/TrangPham.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Django Admin Confirm\n\n[![PyPI](https://img.shields.io/pypi/v/django-admin-confirm?color=blue)](https://pypi.org/project/django-admin-confirm/) ![Tests Status](https://github.com/TrangPham/django-admin-confirm/actions/workflows/.github/workflows/test.yml/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/TrangPham/django-admin-confirm/badge.svg)](https://coveralls.io/github/TrangPham/django-admin-confirm)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-admin-confirm) ![PyPI - Django Version](https://img.shields.io/pypi/djversions/django-admin-confirm)\n![PyPI - License](https://img.shields.io/pypi/l/django_admin_confirm)\n\nAdminConfirmMixin is a mixin for ModelAdmin to add confirmations to change, add and actions.\n\n![Screenshot of Change Confirmation Page](https://raw.githubusercontent.com/TrangPham/django-admin-confirm/302e02b1e483fd41e9a6f0b6803b45cd34c866cf/screenshot.png)\n\n![Screenshot of Add Confirmation Page](https://raw.githubusercontent.com/TrangPham/django-admin-confirm/302e02b1e483fd41e9a6f0b6803b45cd34c866cf/screenshot_confirm_add.png)\n\n![Screenshot of Action Confirmation Page](https://raw.githubusercontent.com/TrangPham/django-admin-confirm/302e02b1e483fd41e9a6f0b6803b45cd34c866cf/screenshot_confirm_action.png)\n\nIt can be configured to add a confirmation page on ModelAdmin upon:\n\n- saving changes\n- adding new instances\n- performing actions\n\nTypical Usage:\n\n```py\n    from admin_confirm import AdminConfirmMixin\n\n    class MyModelAdmin(AdminConfirmMixin, ModelAdmin):\n        confirm_change = True\n        confirmation_fields = ['field1', 'field2']\n```\n\n## Disclaimer\n\nBe aware that not all possible combinations of ModelAdmin have been tested, even if test coverage is high.\n\nSee [testing readme](docs/testing_notes.md) for more details\n\n## Installation\n\nInstall django-admin-confirm by running:\n\n    pip install django-admin-confirm\n\nAdd to INSTALLED_APPS in your project settings before `django.contrib.admin`:\n\n    INSTALLED_APPS = [\n        ...\n        'admin_confirm',\n\n        'django.contrib.admin',\n        ...\n    ]\n\nNote that this project follows the template override rules of Django.\nTo override a template, your app should be listed before `admin_confirm` in INSTALLED_APPS.\n\n## Configuration Options\n\n**Environment Variables**:\n\nCaching is used to cache files for confirmation. When change/add is submitted on the ModelAdmin, if confirmation is required, files will be cached until all validations pass and confirmation is received.\n\n- `ADMIN_CONFIRM_CACHE_TIMEOUT` _default: 1000_\n- `ADMIN_CONFIRM_CACHE_KEY_PREFIX` _default: admin_confirm\\_\\_file_cache_\n\n**Attributes:**\n\n- `confirm_change` _Optional[bool]_ - decides if changes should trigger confirmation\n- `confirm_add` _Optional[bool]_ - decides if additions should trigger confirmation\n- `confirmation_fields` _Optional[Array[string]]_ - sets which fields should trigger confirmation for add/change. If not set or set to `__all__`, it will trigger for all fields. For adding new instances, the field would only trigger a confirmation if the field is set to a value that's not its default.\n- `change_confirmation_template` _Optional[string]_ - path to custom html template to use for change/add\n- `action_confirmation_template` _Optional[string]_ - path to custom html template to use for actions\n\nNote that setting `confirmation_fields` without setting `confirm_change` or `confirm_add` would not trigger confirmation for change/add. Confirmations for actions does not use the `confirmation_fields` option.\n\n**Method Overrides:**\nIf you want even more control over the confirmation, these methods can be overridden:\n\n- `get_confirmation_fields(self, request: HttpRequest, obj: Optional[Object]) -\u003e List[str]`\n- `render_change_confirmation(self, request: HttpRequest, context: dict) -\u003e TemplateResponse`\n- `render_action_confirmation(self, request: HttpRequest, context: dict) -\u003e TemplateResponse`\n\n## Usage\n\n**Confirm Change:**\n\n```py\n    from admin_confirm import AdminConfirmMixin\n\n    class MyModelAdmin(AdminConfirmMixin, ModelAdmin):\n        confirm_change = True\n        confirmation_fields = ['field1', 'field2']\n```\n\nThis would confirm changes on changes that include modifications on`field1` and/or `field2`.\n\n**Confirm Add:**\n\n```py\n    from admin_confirm import AdminConfirmMixin\n\n    class MyModelAdmin(AdminConfirmMixin, ModelAdmin):\n        confirm_add = True\n        confirmation_fields = ['field1', 'field2']\n```\n\nThis would confirm add on adds that set `field1` and/or `field2` to a non default value.\n\nNote: `confirmation_fields` apply to both add/change confirmations.\n\n**Confirm Action:**\n\n```py\n    from admin_confirm import AdminConfirmMixin, confirm_action\n\n    class MyModelAdmin(AdminConfirmMixin, ModelAdmin):\n        actions = [\"action1\", \"action2\"]\n\n        def action1(modeladmin, request, queryset):\n            # Do something with the queryset\n\n        @confirm_action\n        def action2(modeladmin, request, queryset):\n            # Do something with the queryset\n\n        action2.allowed_permissions = ('change',)\n```\n\nThis would confirm `action2` but not `action1`.\n\nAction confirmation will respect `allowed_permissions` and the `has_xxx_permission` methods.\n\n\u003e Note: AdminConfirmMixin does not confirm any changes on inlines\n\n## Contribution \u0026 Appreciation\n\nContributions are most welcome :) Feel free to:\n\n- address an issue\n- raise an issue\n- add more test cases\n- add feature requests\n\nYour appreciation is also very welcome :) Feel free to:\n\n- star the project\n- open an issue just to share your thanks\n\nCheck out our [development process](docs/development_process.md) if you're interested.\n\n## Support\n\nIf you are having issues, please let us know through raising an issue.\n\n## License\n\nThe project is licensed under the Apache 2.0 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTrangPham%2Fdjango-admin-confirm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTrangPham%2Fdjango-admin-confirm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTrangPham%2Fdjango-admin-confirm/lists"}