Add initial data from request.GET to script forms #3126

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

Originally created by @steffann on GitHub (Jan 6, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.6.7
  • NetBox version: 2.6.11

Proposed Functionality

Most NetBox forms are passed initial=request.GET to the constructor so that the request can pass initial values to the form. The extra/scrips functionality doesn't do that. I propose to add it to make forms behaviour consistent.

Use Case

I have a script that requires the user to select a device. With initial=request.GET I would be able to create a custom link from the device page with URL /extras/scripts/example/demo/?router={{ obj.id }} so that a user can easily click from the device page to the script page with the correct device pre-selected.

Database Changes

None

External Dependencies

None

As usual I'll implement this myself once accepted.

Originally created by @steffann on GitHub (Jan 6, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.6.7 * NetBox version: 2.6.11 ### Proposed Functionality Most NetBox forms are passed `initial=request.GET` to the constructor so that the request can pass initial values to the form. The extra/scrips functionality doesn't do that. I propose to add it to make forms behaviour consistent. ### Use Case I have a script that requires the user to select a device. With `initial=request.GET` I would be able to create a custom link from the device page with URL `/extras/scripts/example/demo/?router={{ obj.id }}` so that a user can easily click from the device page to the script page with the correct device pre-selected. ### Database Changes None ### External Dependencies None As usual I'll implement this myself once accepted.
adam added the status: acceptedtype: feature labels 2025-12-29 18:25:57 +01:00
adam closed this issue 2025-12-29 18:25:57 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3126