Skip to content

[fix] Added delete_confirmation_template attr in DeviceAdmin#1239

Merged
nemesifier merged 2 commits into
openwisp:masterfrom
asmodehn:specify_missing_template
May 8, 2026
Merged

[fix] Added delete_confirmation_template attr in DeviceAdmin#1239
nemesifier merged 2 commits into
openwisp:masterfrom
asmodehn:specify_missing_template

Conversation

@asmodehn
Copy link
Copy Markdown
Member

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Description of Changes

This add delete_confirmation_template attr to the Device Admin class, just like other templates.
Without it, selenium deletion tests will fail on apps deriving from config, that are not named config.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

A custom delete confirmation template is specified for the DeviceAdmin class by adding a delete_confirmation_template attribute that points to admin/config/device/delete_confirmation.html. This is a single-line configuration addition that does not alter any existing functionality or logic.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title uses the correct [type] format but uses [fix] when the change is actually an addition/feature. The summary indicates this adds a missing template attribute, which is a feature/change rather than a fix. Update the title to use [change] or [feature] instead of [fix], such as '[change] Add delete_confirmation_template attr in DeviceAdmin' to accurately reflect that this adds a new attribute rather than fixing a bug.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description covers the core change and motivation, but lacks reference to an issue number and screenshots. Two checklist items remain unchecked.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

delete_selected_confirmation_template = (
"admin/config/device/delete_selected_confirmation.html"
)
delete_confirmation_template = "admin/config/device/delete_confirmation.html"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asmodehn if this is missing, you run into issues? Could you provide an example? Just double checking.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I write a custom_config app with Admin classes that inherit from the config app, during the deletion (and without adding my own deletion template in the custom_config app), the template that django displays is the default "admin/delete_confirmation.html"
So in openwisp usecase, it means the "warning" part was skipped, so the deletion workflow ended up to be different

Note: this behavior is different than with other templates (as they are defined as attributes)

That behavior is explicited there :
https://github.com/django/django/blob/main/django/contrib/admin/options.py#L1769
Without that attribute, django assumes a default template name for this app, or replace it with its own default template.

@nemesifier nemesifier changed the title [change] Add delete_confirmation_template attr in DeviceAdmin [fix] Added delete_confirmation_template attr in DeviceAdmin May 8, 2026
@nemesifier nemesifier merged commit 476cbb9 into openwisp:master May 8, 2026
15 checks passed
@nemesifier
Copy link
Copy Markdown
Member

Thanks for the explanation @asmodehn 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants