Skip to content

[backport] #1303: [fix] Fix duplicate template entries in Device admin (to 1.2)#1324

Merged
nemesifier merged 2 commits into1.2from
backport/1303-to-1.2-1774628819
Mar 27, 2026
Merged

[backport] #1303: [fix] Fix duplicate template entries in Device admin (to 1.2)#1324
nemesifier merged 2 commits into1.2from
backport/1303-to-1.2-1774628819

Conversation

@openwisp-companion
Copy link
Copy Markdown

Backport of #1303 to 1.2.

@openwisp-companion
Copy link
Copy Markdown
Author

Test Failure in test_add_mobile_location

Hello @app/openwisp-companion and @openwisp-companion[bot],
(Analysis for commit 68c1ae0)

The test test_add_mobile_location failed with an AssertionError: 0 != 1. This indicates that the test expected one mobile location to be present in the database, but found zero.

Fix:
Review the test setup and the logic within test_add_mobile_location to ensure that a mobile location is correctly created and persisted before the assertion is made. It's possible that the creation step is failing silently or the data is not being committed to the database in the test environment.

@nemesifier nemesifier force-pushed the backport/1303-to-1.2-1774628819 branch from ed245e1 to 326703d Compare March 27, 2026 21:46
@openwisp-companion
Copy link
Copy Markdown
Author

Flake8 F541 f-string missing placeholders

Hello @app/openwisp-companion and @nemesifier,
(Analysis for commit 326703d)

There is an f-string in openwisp_controller/config/tests/test_selenium.py that is missing placeholders.

Fix:
Locate the f-string on line 429 of openwisp_controller/config/tests/test_selenium.py and ensure all intended placeholders are correctly formatted within the string.

pandafy added 2 commits March 27, 2026 20:28
Bug:
The JS logic in relevant_templates.js assumed that the last
`ul.sortedm2m-items` element belonged to the empty inline form used by
Django admin formsets. This assumption breaks when the user does not
have permission to add Config objects: in that case the
ConfigInlineAdmin does not render the empty form.

As a result, both selectors ended up referencing the same list and the
script appended template elements twice to the same `sortedm2m` list,
causing duplicate entries and issues when saving the form.

Fix:
Select the empty form container explicitly using `#config-empty
ul.sortedm2m-items` instead of relying on the last occurrence of
`ul.sortedm2m-items`. This ensures the logic works correctly regardless
of whether the empty inline form is rendered.

[backport 1.2]

(cherry picked from commit b73e83a)
@nemesifier nemesifier force-pushed the backport/1303-to-1.2-1774628819 branch from 326703d to ce0cfd7 Compare March 27, 2026 23:36
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 98.623% (+0.03%) from 98.595%
when pulling ce0cfd7 on backport/1303-to-1.2-1774628819
into 9531b8b on 1.2.

@nemesifier nemesifier merged commit 7c26901 into 1.2 Mar 27, 2026
17 checks passed
@nemesifier nemesifier deleted the backport/1303-to-1.2-1774628819 branch March 27, 2026 23:58
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.

3 participants