Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many-to-many fields do not trigger confirmation unless specified in "get_confirmation_fields" method #48

Open
e-kondr01 opened this issue May 3, 2023 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@e-kondr01
Copy link

Describe the bug
I use AdminConfirmMixin and admin.ModelAdmin, setting confirm_change = True. Fields that are not ManyToMany correctly trigger confirmation page. However, my ManyToManyField did not trigger it until I included it in the return value of get_confirmation_fields.

Expected behavior
If no confirmation_fields are specified, then all model fields should trigger confirmation page, even ManyToManyField type ones.

Versions
django-admin-confirm==1.0.0
python 3.11

Additional context
There reason is this line:
https://github.com/TrangPham/django-admin-confirm/blob/main/admin_confirm/admin.py#L58
ManyToManyFields do not appear in model._meta.fields

@TrangPham
Copy link
Owner

Ah thanks for such a great bug report!

I'd be very happy to review a change from you or others. Marking as a good starter ticket.

@TrangPham TrangPham added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels May 10, 2023
@e-kondr01
Copy link
Author

A futher note is that after you explicitly specify a M2M field in confirmation_fields, every save will trigger the confirmation page, even if no data has been changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants