Position field missing for Module Bay bulk creation #6392

Closed
opened 2025-12-29 19:40:10 +01:00 by adam · 3 comments
Owner

Originally created by @sleepinggenius2 on GitHub (Apr 21, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.2.1

Python version

3.8

Steps to Reproduce

  1. Select one of more devices from the Devices list
  2. Click on Add Components > Module Bays
  3. Observe there is no Position field

Expected Behavior

The bulk creation form for Module Bays should have a Position field just like the singular add form.

Observed Behavior

The Position field does not exist on the bulk creation form.

Originally created by @sleepinggenius2 on GitHub (Apr 21, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.2.1 ### Python version 3.8 ### Steps to Reproduce 1. Select one of more devices from the Devices list 2. Click on Add Components > Module Bays 3. Observe there is no Position field ### Expected Behavior The bulk creation form for Module Bays should have a Position field just like the singular add form. ### Observed Behavior The Position field does not exist on the bulk creation form.
adam added the type: bugstatus: accepted labels 2025-12-29 19:40:10 +01:00
adam closed this issue 2025-12-29 19:40:10 +01:00
Author
Owner

@sleepinggenius2 commented on GitHub (May 13, 2022):

I've checked this in v3.2.2 and v3.2.3 and it doesn't actually seem to be working. The field shows up in the form and the module bays are created, but the position fields are empty.

@sleepinggenius2 commented on GitHub (May 13, 2022): I've checked this in v3.2.2 and v3.2.3 and it doesn't actually seem to be working. The field shows up in the form and the module bays are created, but the position fields are empty.
Author
Owner

@sleepinggenius2 commented on GitHub (Jun 8, 2022):

@jeremystretch, can we reopen this issue or do you need me to open a new one? I finally tracked down what I believe to be the source of this bug and I'm not 100% on how to fix it, but I'm willing to give it a shot.

The DeviceBulkAddModuleBayView class in netbox/dcim/views.py inherits from generic.BulkComponentCreateView, but in that class (within netbox/netbox/views/generic/bulk_views.py), the post function is hard-coded for name_pattern and label_pattern.

The ModuleBayCreateView class in netbox/dcim/views.py inherits from generic.ComponentCreateView and sets patterned_fields = ('name', 'label', 'position'), then in that class (within netbox/netbox/views/generic/object_views.py), the post function uses the patterned_fields variable to set the appropriate values.

This would explain why the position field is being properly set for the single component creation, but not the bulk.

@sleepinggenius2 commented on GitHub (Jun 8, 2022): @jeremystretch, can we reopen this issue or do you need me to open a new one? I finally tracked down what I believe to be the source of this bug and I'm not 100% on how to fix it, but I'm willing to give it a shot. The `DeviceBulkAddModuleBayView` class in `netbox/dcim/views.py` inherits from `generic.BulkComponentCreateView`, but in that class (within `netbox/netbox/views/generic/bulk_views.py`), the `post` function is hard-coded for `name_pattern` and `label_pattern`. The `ModuleBayCreateView` class in `netbox/dcim/views.py` inherits from `generic.ComponentCreateView` and sets `patterned_fields = ('name', 'label', 'position')`, then in that class (within `netbox/netbox/views/generic/object_views.py`), the `post` function uses the `patterned_fields` variable to set the appropriate values. This would explain why the `position` field is being properly set for the single component creation, but not the bulk.
Author
Owner

@sleepinggenius2 commented on GitHub (Jun 9, 2022):

I believe that I have a working solution, if you would like me to submit a PR.

@sleepinggenius2 commented on GitHub (Jun 9, 2022): I believe that I have a working solution, if you would like me to submit a PR.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6392