BulkImportView doesn't honor return_url query parameter #9290

Closed
opened 2025-12-29 20:47:53 +01:00 by adam · 1 comment
Owner

Originally created by @alehaa on GitHub (Feb 26, 2024).

Deployment Type

Self-hosted

NetBox Version

v3.7.3

Python Version

3.11

Steps to Reproduce

  1. Go to demo.netbox.dev
  2. Go to Site bulk import and add valid query parameter return_url to its URL, e.g. https://demo.netbox.dev/dcim/sites/import/?return_url=/dcim/devices
  3. Import data:
    name,slug,status
    Foo Bar,foobar,active
    

Expected Behavior

Being redirected to URL /dcim/devices.

As BulkImportView uses GetReturnURLMixin, one might assume the default behavior of calling get_return_url() is used in the view's post() method. However, a static reference to the object's list view will be used instead. For plugins using this generic API view, this might be misleading. Some might to use this functionality as long as its part of the API.

Observed Behavior

Being redirected to site list view /dcim/sites/?modified_by_request=....

Originally created by @alehaa on GitHub (Feb 26, 2024). ### Deployment Type Self-hosted ### NetBox Version v3.7.3 ### Python Version 3.11 ### Steps to Reproduce 1. Go to [demo.netbox.dev](https://demo.netbox.dev/) 2. Go to *Site bulk import* and add valid query parameter `return_url` to its URL, e.g. https://demo.netbox.dev/dcim/sites/import/?return_url=/dcim/devices 3. Import data: ```csv name,slug,status Foo Bar,foobar,active ``` ### Expected Behavior Being redirected to URL `/dcim/devices`. As [`BulkImportView` uses `GetReturnURLMixin`](https://github.com/netbox-community/netbox/blob/edb7d24b458b60fa82b16bc37e79f37821e3685f/netbox/netbox/views/generic/bulk_views.py#L296), one might assume the default behavior of calling `get_return_url()` is used in the view's `post()` method. However, a static reference to the object's list view [will be used](https://github.com/netbox-community/netbox/blob/edb7d24b458b60fa82b16bc37e79f37821e3685f/netbox/netbox/views/generic/bulk_views.py#L475) instead. For plugins using this generic API view, this might be misleading. Some might to use this functionality as long as its part of the API. ### Observed Behavior Being redirected to site list view `/dcim/sites/?modified_by_request=...`.
adam closed this issue 2025-12-29 20:47:53 +01:00
Author
Owner

@jeremystretch commented on GitHub (Feb 29, 2024):

  1. Go to demo.netbox.dev

Per the bug report template: Do not rely on the demo instance for reproducing suspected bugs.

  1. Go to Site bulk import and add valid query parameter

The return_url parameter is not supported by this view because, as you've already discovered, the user is always redirected to the list of imported objects. This is a not a bug.

@jeremystretch commented on GitHub (Feb 29, 2024): > 1. Go to [demo.netbox.dev](https://demo.netbox.dev/) Per the bug report template: **Do not rely on the demo instance** for reproducing suspected bugs. > 2. Go to Site bulk import and add valid query parameter The `return_url` parameter is not supported by this view because, as you've already discovered, the user is always redirected to the list of imported objects. This is a not a bug.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9290