Allow adding of objects based on the table filters #6928

Closed
opened 2025-12-29 19:46:53 +01:00 by adam · 2 comments
Owner

Originally created by @abhi1693 on GitHub (Sep 4, 2022).

NetBox version

v3.3.2

Feature type

Change to existing functionality

Proposed functionality

Go to any table and filter your results using the provided filters. Then, click on Add button to auto-fill the form based on the filters from the table.

Example: I selected a site and a model for the device table

image

Now, I would prefer to click on Add and this information is pre-populated.

image

Use case

I often end up searching for objects with the help of filters and adding a new object afterwards. However, after clicking the add button, I have to fill the form again with the same filters. It would benefit the users a lot to have this convenience in place of filters getting copied for creating objects, this is a similar feature to Clone but on a broader aspect.

So far, I have been wanting something like this when I search for a device type and click on the Instances to filter all by the same type. I wanted to add a device of the same type directly. Being this is too restrictive a use case, I would prefer if people want this for all objects in NetBox.

Database changes

None

External dependencies

None

Originally created by @abhi1693 on GitHub (Sep 4, 2022). ### NetBox version v3.3.2 ### Feature type Change to existing functionality ### Proposed functionality Go to any table and filter your results using the provided filters. Then, click on `Add` button to auto-fill the form based on the filters from the table. Example: I selected a site and a model for the device table ![image](https://user-images.githubusercontent.com/5083532/188301723-ec1cda27-2f12-4b3d-8263-e0479a5d1c29.png) Now, I would prefer to click on `Add` and this information is pre-populated. ![image](https://user-images.githubusercontent.com/5083532/188301748-37af0fa7-c54b-4695-aad5-dd5ecf03ea9d.png) ### Use case I often end up searching for objects with the help of filters and adding a new object afterwards. However, after clicking the add button, I have to fill the form again with the same filters. It would benefit the users a lot to have this convenience in place of filters getting copied for creating objects, this is a similar feature to `Clone` but on a broader aspect. So far, I have been wanting something like this when I search for a device type and click on the `Instances` to filter all by the same type. I wanted to add a device of the same type directly. Being this is too restrictive a use case, I would prefer if people want this for all objects in NetBox. ### Database changes None ### External dependencies None
adam added the type: feature label 2025-12-29 19:46:53 +01:00
adam closed this issue 2025-12-29 19:46:53 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 6, 2022):

Go to any table and filter your results using the provided filters. Then, click on Add button to auto-fill the form based on the filters from the table.

Changing the current behavior of the primary "add" button in this way would be disruptive and confusing, so I'm afraid that's a non-starter. We could potentially look at adding a second, smaller "add" button somewhere that it's obviously associated with the application of filters, however there's another, larger impediment to what you're proposing.

While filters and form fields often overlap, they work very differently. Filters are defined entirely independently of form fields, and typically accept multiple values. For example, suppose you filter the devices list by three sites (A, B, and C) so that the applied query parameters look like this:

?site_id=1&site_id=2&site_id=3

Obviously, we can't create a device that belongs to three different sites, so what would the proposed "add" button do? Additionally, you'll notice that the filter is named device_id whereas the form field is named device; there is no automatic mapping between these.

While it's a neat idea, I'm afraid it would take far too much hacking to implement the proposed behavior in a way that's natural and unsurprising.

@jeremystretch commented on GitHub (Sep 6, 2022): > Go to any table and filter your results using the provided filters. Then, click on Add button to auto-fill the form based on the filters from the table. Changing the current behavior of the primary "add" button in this way would be disruptive and confusing, so I'm afraid that's a non-starter. We could potentially look at adding a second, smaller "add" button somewhere that it's obviously associated with the application of filters, however there's another, larger impediment to what you're proposing. While filters and form fields often overlap, they work very differently. Filters are defined entirely independently of form fields, and typically accept multiple values. For example, suppose you filter the devices list by three sites (A, B, and C) so that the applied query parameters look like this: ``` ?site_id=1&site_id=2&site_id=3 ``` Obviously, we can't create a device that belongs to three different sites, so what would the proposed "add" button do? Additionally, you'll notice that the filter is named `device_id` whereas the form field is named `device`; there is no automatic mapping between these. While it's a neat idea, I'm afraid it would take far too much hacking to implement the proposed behavior in a way that's natural and unsurprising.
Author
Owner

@jeremystretch commented on GitHub (Sep 15, 2022):

I'm going to close this out as there hasn't been any further discussion. Happy to revisit this idea if anyone would like to propose a specific implementation scheme.

@jeremystretch commented on GitHub (Sep 15, 2022): I'm going to close this out as there hasn't been any further discussion. Happy to revisit this idea if anyone would like to propose a specific implementation scheme.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6928