Skip to main content

Django Admin Confirm

PyPI Tests Status Coverage Status PyPI - Python Version PyPI - Django Version PyPI - License

AdminConfirmMixin is a mixin for ModelAdmin to add confirmations to change, add and actions.

Screenshot of Change Confirmation Page

Screenshot of Add Confirmation Page

Screenshot of Action Confirmation Page

It can be configured to add a confirmation page on ModelAdmin upon:

  • saving changes
  • adding new instances
  • performing actions

Typical Usage:

    from admin_confirm import AdminConfirmMixin

    class MyModelAdmin(AdminConfirmMixin, ModelAdmin):
        confirm_change = True
        confirmation_fields = ['field1', 'field2']

Disclaimer

Be aware that not all possible combinations of ModelAdmin have been tested, even if test coverage is high.

See testing readme for more details

Installation

Install django-admin-confirm by running:

pip install django-admin-confirm

Python Support

  • Supported: Python 3.10 - 3.14

Add to INSTALLED_APPS in your project settings before django.contrib.admin:

INSTALLED_APPS = [
    ...
    'admin_confirm',

    'django.contrib.admin',
    ...
]

Note that this project follows the template override rules of Django. To override a template, your app should be listed before admin_confirm in INSTALLED_APPS.

Configuration Options

Environment Variables:

Caching 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.

  • ADMIN_CONFIRM_CACHE_TIMEOUT default: 1000
  • ADMIN_CONFIRM_CACHE_KEY_PREFIX default: admin_confirm__file_cache

Attributes:

  • confirm_change Optional[bool] - decides if changes should trigger confirmation
  • confirm_add Optional[bool] - decides if additions should trigger confirmation
  • 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.
  • change_confirmation_template Optional[string] - path to custom html template to use for change/add
  • action_confirmation_template Optional[string] - path to custom html template to use for actions

Note 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.

Method Overrides: If you want even more control over the confirmation, these methods can be overridden:

  • get_confirmation_fields(self, request: HttpRequest, obj: Optional[Object]) -> List[str]
  • get_add_confirmation_message(self, request: HttpRequest, obj: Optional[Object]) -> Optional[str] - returns the message shown on the confirmation page when adding. Default None renders the built-in message.
  • get_change_confirmation_message(self, request: HttpRequest, obj: Optional[Object], changed_data: Optional[dict]) -> Optional[str] - returns the message shown on the confirmation page when changing. Default None renders the built-in message.
  • get_action_confirmation_message(self, request: HttpRequest, queryset: QuerySet) -> Optional[str] - returns the message shown on the confirmation page for actions decorated with @confirm_action. Default None renders the built-in message.
  • render_change_confirmation(self, request: HttpRequest, context: dict) -> TemplateResponse
  • render_action_confirmation(self, request: HttpRequest, context: dict) -> TemplateResponse

Usage

Confirm Change:

    from admin_confirm import AdminConfirmMixin

    class MyModelAdmin(AdminConfirmMixin, ModelAdmin):
        confirm_change = True
        confirmation_fields = ['field1', 'field2']

This would confirm changes on changes that include modifications onfield1 and/or field2.

Confirm Add:

    from admin_confirm import AdminConfirmMixin

    class MyModelAdmin(AdminConfirmMixin, ModelAdmin):
        confirm_add = True
        confirmation_fields = ['field1', 'field2']

This would confirm add on adds that set field1 and/or field2 to a non default value.

Note: confirmation_fields apply to both add/change confirmations.

Confirm Action:

    from admin_confirm import AdminConfirmMixin, confirm_action

    class MyModelAdmin(AdminConfirmMixin, ModelAdmin):
        actions = ["action1", "action2"]

        def action1(modeladmin, request, queryset):
            # Do something with the queryset

        @confirm_action
        def action2(modeladmin, request, queryset):
            # Do something with the queryset

        action2.allowed_permissions = ('change',)

This would confirm action2 but not action1.

Action confirmation will respect allowed_permissions and the has_xxx_permission methods.

Custom Confirmation Message:

    from admin_confirm import AdminConfirmMixin

    class MyModelAdmin(AdminConfirmMixin, ModelAdmin):
        confirm_change = True

        def get_change_confirmation_message(self, request, obj=None, changed_data=None):
            return f"Please double-check the price changes for {obj}"

The confirmation page will show the returned message instead of the built-in one. Returning None (the default) keeps the built-in message. The same can be done for adds with get_add_confirmation_message and for actions with get_action_confirmation_message.

Note: AdminConfirmMixin does not confirm any changes on inlines

Contribution & Appreciation

Contributions are most welcome :) Feel free to:

  • address an issue
  • raise an issue
  • add more test cases
  • add feature requests

Your appreciation is also very welcome :) Feel free to:

  • star the project
  • open an issue just to share your thanks

Check out our development process if you're interested.

Support

If you are having issues, please let us know through raising an issue.

License

The project is licensed under the Apache 2.0 license.

Metadata

Release files for django-admin-confirm 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-admin-confirm 1.3.1
File Size Uploaded
django_admin_confirm-1.3.1.tar.gz 18.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-admin-confirm 1.3.1
File Interpreter ABI Platform
django_admin_confirm-1.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 37.9 kB

Release files / django_admin_confirm-1.3.1.tar.gz

Download URL django_admin_confirm-1.3.1.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
923bf616a4a36ed6a8bb7d21c813b33d12003e1d6b339e3d9f5bd6d661db79bb
BLAKE2b-256 checksum
How to use checksums
324fcd72f5c6c3f0b072c38a054f9dd4b519f3e35f7f65f1e3c931c917addd79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release files / django_admin_confirm-1.3.1-py3-none-any.whl

Download URL django_admin_confirm-1.3.1-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48f1ad59b2d9815fb1e3695549afe554e7db593090ebc9441a55fbe2739b658f
BLAKE2b-256 checksum
How to use checksums
c3ff0e1b8d216adf9bf0831b6619f0887323e52226b62a9662b7546ebacab3f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.3.1 This release

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.0.1

2 release files

1.0.0

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2

1 release file

0.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page