Standardize rack reservation creation URL #3476

Closed
opened 2025-12-29 18:29:25 +01:00 by adam · 1 comment
Owner

Originally created by @jeremystretch on GitHub (Mar 12, 2020).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

Change the URL for creating new RackReservations to match the standard form for all models; from

/dcim/racks/<id>/reservations/add/

to

/dcim/rack-reservations/add/?rack_id=<id>

Justification

This provides a more consistent URL scheme and allows us to include the view using our stock test case without modifications. It also makes for a slightly cleaner user experience.

Originally created by @jeremystretch on GitHub (Mar 12, 2020). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes Change the URL for creating new RackReservations to match the standard form for all models; from ``` /dcim/racks/<id>/reservations/add/ ``` to ``` /dcim/rack-reservations/add/?rack_id=<id> ``` ### Justification This provides a more consistent URL scheme and allows us to include the view using our stock test case without modifications. It also makes for a slightly cleaner user experience.
adam added the status: acceptedtype: housekeeping labels 2025-12-29 18:29:25 +01:00
adam closed this issue 2025-12-29 18:29:25 +01:00
Author
Owner

@mtinberg commented on GitHub (Apr 3, 2020):

I'm not sure how to report this but the URL change to rack.html is typo'd, the '&' should be '?' the current URls get "Page Not Found" errors if you try to edit or delete a Rack Reservation from the Rack page.

diff --git a/netbox/templates/dcim/rack.html b/netbox/templates/dcim/rack.html
index 756f9619..8bfac85d 100644
--- a/netbox/templates/dcim/rack.html
+++ b/netbox/templates/dcim/rack.html
@@ -289,12 +289,12 @@
                             </td>
                             <td class="text-right noprint">
                                 {% if perms.dcim.change_rackreservation %}
-                                    <a href="{% url 'dcim:rackreservation_edit' pk=resv.pk %}&return_url={{ rack.get_absolute_url }}" class="btn btn-warning btn-xs" title="Edit reservation">
+                                    <a href="{% url 'dcim:rackreservation_edit' pk=resv.pk %}?return_url={{ rack.get_absolute_url }}" class="btn btn-warning btn-xs" title="Edit reservation">
                                         <i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>
                                     </a>
                                 {% endif %}
                                 {% if perms.dcim.delete_rackreservation %}
-                                    <a href="{% url 'dcim:rackreservation_delete' pk=resv.pk %}&return_url={{ rack.get_absolute_url }}" class="btn btn-danger btn-xs" title="Delete reservation">
+                                    <a href="{% url 'dcim:rackreservation_delete' pk=resv.pk %}?return_url={{ rack.get_absolute_url }}" class="btn btn-danger btn-xs" title="Delete reservation">
                                         <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
                                     </a>
                                 {% endif %}
@mtinberg commented on GitHub (Apr 3, 2020): I'm not sure how to report this but the URL change to rack.html is typo'd, the '&' should be '?' the current URls get "Page Not Found" errors if you try to edit or delete a Rack Reservation from the Rack page. ```diff diff --git a/netbox/templates/dcim/rack.html b/netbox/templates/dcim/rack.html index 756f9619..8bfac85d 100644 --- a/netbox/templates/dcim/rack.html +++ b/netbox/templates/dcim/rack.html @@ -289,12 +289,12 @@ </td> <td class="text-right noprint"> {% if perms.dcim.change_rackreservation %} - <a href="{% url 'dcim:rackreservation_edit' pk=resv.pk %}&return_url={{ rack.get_absolute_url }}" class="btn btn-warning btn-xs" title="Edit reservation"> + <a href="{% url 'dcim:rackreservation_edit' pk=resv.pk %}?return_url={{ rack.get_absolute_url }}" class="btn btn-warning btn-xs" title="Edit reservation"> <i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> </a> {% endif %} {% if perms.dcim.delete_rackreservation %} - <a href="{% url 'dcim:rackreservation_delete' pk=resv.pk %}&return_url={{ rack.get_absolute_url }}" class="btn btn-danger btn-xs" title="Delete reservation"> + <a href="{% url 'dcim:rackreservation_delete' pk=resv.pk %}?return_url={{ rack.get_absolute_url }}" class="btn btn-danger btn-xs" title="Delete reservation"> <i class="glyphicon glyphicon-trash" aria-hidden="true"></i> </a> {% endif %} ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3476