[PR #20268] [MERGED] Fixes #20234: Correct add_button return_url for prerequisite models #15866

Closed
opened 2025-12-30 00:24:30 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20268
Author: @pheus
Created: 9/5/2025
Status: Merged
Merged: 9/5/2025
Merged by: @jnovinger

Base: mainHead: 20234-fix-missing-prerequisites-add-button


📝 Commits (1)

  • a9f041b fix(templates/inc): Correct add_button return_url

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 netbox/templates/inc/missing_prerequisites.html (+1 -1)

📄 Description

Fixes: #20234

Summary
The generic prerequisite include was passing request.path as the second positional argument to the add_button template tag. Because the tag expects (model, action, return_url), this caused request.path to be interpreted as action, breaking the "+ Add" link in banners such as "Before you can add a power feed you must first create a power panel."

Change
Pass the return_url by name so it’s bound correctly by the tag:

{% add_button prerequisite_model return_url=request.path %}

User impact
Clicking "+ Add" on any prerequisite banner now opens the correct add form and returns the user to the originating page upon completion.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/20268 **Author:** [@pheus](https://github.com/pheus) **Created:** 9/5/2025 **Status:** ✅ Merged **Merged:** 9/5/2025 **Merged by:** [@jnovinger](https://github.com/jnovinger) **Base:** `main` ← **Head:** `20234-fix-missing-prerequisites-add-button` --- ### 📝 Commits (1) - [`a9f041b`](https://github.com/netbox-community/netbox/commit/a9f041b482fd775d73e1160b6531d2e2f51fc158) fix(templates/inc): Correct add_button return_url ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `netbox/templates/inc/missing_prerequisites.html` (+1 -1) </details> ### 📄 Description ### Fixes: #20234 **Summary** The generic prerequisite include was passing `request.path` as the second positional argument to the `add_button` template tag. Because the tag expects `(model, action, return_url)`, this caused `request.path` to be interpreted as `action`, breaking the "+ Add" link in banners such as "Before you can add a power feed you must first create a power panel." **Change** Pass the `return_url` by name so it’s bound correctly by the tag: ~~~django {% add_button prerequisite_model return_url=request.path %} ~~~ **User impact** Clicking "+ Add" on any prerequisite banner now opens the correct add form and returns the user to the originating page upon completion. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:24:30 +01:00
adam closed this issue 2025-12-30 00:24:30 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15866