Rename device component create/edit/delete URLs #3273

Closed
opened 2025-12-29 18:27:19 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Feb 4, 2020).

Proposed Changes

Rename and standardize URLs for the addition, modification, and deletion of device components so that they no longer require passing a parent device ID.

Justification

Let's look at interface URL patterns as an example:

devices/interfaces/add/': views.DeviceBulkAddInterfaceView
devices/<int:pk>/interfaces/add/': views.InterfaceCreateView
devices/<int:pk>/interfaces/edit/': views.InterfaceBulkEditView
devices/<int:pk>/interfaces/delete/': views.InterfaceBulkDeleteView
interfaces/': views.InterfaceListView
interfaces/<int:termination_a_id>/connect/<str:termination_b_type>/': views.CableCreateView
interfaces/<int:pk>/': views.InterfaceView
interfaces/<int:pk>/edit/': views.InterfaceEditView
interfaces/<int:pk>/delete/': views.InterfaceDeleteView
interfaces/<int:pk>/changelog/', ObjectChangeLogView
interfaces/<int:pk>/trace/': views.CableTraceView
interfaces/rename/': views.InterfaceBulkRenameView
interfaces/disconnect/': views.InterfaceBulkDisconnectView
interfaces/import/': views.InterfaceBulkImportView

The URLs for InterfaceCreateView, InterfaceBulkEditView, and InterfaceBulkDeleteView all require specifying a parent device ID. This was done due to limitations in the forms early on, but is no longer necessary. We should rename these URLs as follows to simplify view and logic and testing:

interfaces/add/
interfaces/edit/
interfaces/delete/

(The URL for DeviceBulkAddInterfaceView should remain unchanged, as it deals specifically with creating interfaces for many devices at once.)

This change is proposed for all device component types.

Originally created by @jeremystretch on GitHub (Feb 4, 2020). ### Proposed Changes Rename and standardize URLs for the addition, modification, and deletion of device components so that they no longer require passing a parent device ID. ### Justification Let's look at interface URL patterns as an example: ``` devices/interfaces/add/': views.DeviceBulkAddInterfaceView devices/<int:pk>/interfaces/add/': views.InterfaceCreateView devices/<int:pk>/interfaces/edit/': views.InterfaceBulkEditView devices/<int:pk>/interfaces/delete/': views.InterfaceBulkDeleteView interfaces/': views.InterfaceListView interfaces/<int:termination_a_id>/connect/<str:termination_b_type>/': views.CableCreateView interfaces/<int:pk>/': views.InterfaceView interfaces/<int:pk>/edit/': views.InterfaceEditView interfaces/<int:pk>/delete/': views.InterfaceDeleteView interfaces/<int:pk>/changelog/', ObjectChangeLogView interfaces/<int:pk>/trace/': views.CableTraceView interfaces/rename/': views.InterfaceBulkRenameView interfaces/disconnect/': views.InterfaceBulkDisconnectView interfaces/import/': views.InterfaceBulkImportView ``` The URLs for InterfaceCreateView, InterfaceBulkEditView, and InterfaceBulkDeleteView all require specifying a parent device ID. This was done due to limitations in the forms early on, but is no longer necessary. We should rename these URLs as follows to simplify view and logic and testing: ``` interfaces/add/ interfaces/edit/ interfaces/delete/ ``` (The URL for DeviceBulkAddInterfaceView should remain unchanged, as it deals specifically with creating interfaces for many devices at once.) This change is proposed for _all_ device component types.
adam added the status: under reviewtype: housekeeping labels 2025-12-29 18:27:19 +01:00
adam closed this issue 2025-12-29 18:27:19 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3273