Bulk edit of pass-through ports not saving when ports 1 and 2 selected #2398

Closed
opened 2025-12-29 17:25:44 +01:00 by adam · 6 comments
Owner

Originally created by @kwoodVisions on GitHub (Feb 19, 2019).

Environment

  • Python version: 3.5.2
  • NetBox version: 2.5.6

Bulk-editing of pass-through ports does not save if ports 1 and 2 are selected in the range of ports to edit. If all ports are selected except 1 and 2, changes do save. This occurs with Front and Rear ports.

Steps to Reproduce

  1. Navigate in the system to one of our patch panels.
  2. Scroll down to either Front Ports or Rear Ports.
  3. Click check box next to "Name" to select all ports.
  4. Scroll down and click "Edit" underneath the section selected.
  5. On the bulk edit page, change any setting - doesn't matter which.
  6. Click Apply.
  7. Browser does not navigate away from the page. What you had attempted to change does not in fact change.
  8. Go back to the patch panel page, scroll down to the Front Ports or Rear Ports section and click the check box next to "Name".
  9. Uncheck ports 1 and 2.
  10. Scroll down and click "Edit".
  11. Edit anything - description, type, etc.
  12. Click Apply - your changes have now been saved.

** This also works if you just randomly select any port in the list, so long as you do not select port 1 or 2.

The expect behavior is that when clicking Apply, the changes I entered would be applied.

Changes were not saved. The same bulk edit page was displayed again without any changes.

Originally created by @kwoodVisions on GitHub (Feb 19, 2019). ### Environment * Python version: 3.5.2 * NetBox version: 2.5.6 Bulk-editing of pass-through ports does not save if ports 1 and 2 are selected in the range of ports to edit. If all ports are selected except 1 and 2, changes do save. This occurs with Front and Rear ports. ### Steps to Reproduce 1. Navigate in the system to one of our patch panels. 2. Scroll down to either Front Ports or Rear Ports. 3. Click check box next to "Name" to select all ports. 4. Scroll down and click "Edit" underneath the section selected. 5. On the bulk edit page, change any setting - doesn't matter which. 6. Click Apply. 7. Browser does not navigate away from the page. What you had attempted to change does not in fact change. 8. Go back to the patch panel page, scroll down to the Front Ports or Rear Ports section and click the check box next to "Name". 9. Uncheck ports 1 and 2. 10. Scroll down and click "Edit". 11. Edit anything - description, type, etc. 12. Click Apply - your changes have now been saved. ** This also works if you just randomly select any port in the list, so long as you do not select port 1 or 2. <!-- What did you expect to happen? --> The expect behavior is that when clicking Apply, the changes I entered would be applied. <!-- What happened instead? --> Changes were not saved. The same bulk edit page was displayed again without any changes.
adam added the type: bugstatus: accepted labels 2025-12-29 17:25:44 +01:00
adam closed this issue 2025-12-29 17:25:44 +01:00
Author
Owner

@jeremystretch commented on GitHub (Feb 20, 2019):

I'm not able to reproduce this. This part:

  1. Browser does not navigate away from the page

suggests to me that it's a browser issue. The "Apply" button is just a regular <button type="submit"> element; there's no Javascript involved.

I see that you've already got a thread going on the mailing list, so I'm going to close this out for now and continue the discussion there. If we find a way to reproduce the behavior, I'll reopen this issue.

@jeremystretch commented on GitHub (Feb 20, 2019): I'm not able to reproduce this. This part: > 7. Browser does not navigate away from the page suggests to me that it's a browser issue. The "Apply" button is just a regular `<button type="submit">` element; there's no Javascript involved. I see that you've already got a thread going [on the mailing list](https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/netbox-discuss/xILvZpyURHo/sIcc9bYkAwAJ), so I'm going to close this out for now and continue the discussion there. If we find a way to reproduce the behavior, I'll reopen this issue.
Author
Owner

@jeremystretch commented on GitHub (Feb 20, 2019):

Per Brian Candler on the mailing list:

OK, I can reproduce this now!

  • pick any device
  • add rearports using pattern [1-96]. Defaults for all other fields.
  • back at the device, select all rearports (using the checkbox which selects all)
  • select Edit
  • select type 100 Punch
  • click Apply

The page just refreshes.

@jeremystretch commented on GitHub (Feb 20, 2019): Per Brian Candler on the mailing list: > OK, I can reproduce this now! > > - pick any device > - add rearports using pattern [1-96]. Defaults for all other fields. > - back at the device, select all rearports (using the checkbox which selects all) > - select Edit > - select type 100 Punch > - click Apply > > The page just refreshes.
Author
Owner

@kwoodVisions commented on GitHub (Feb 20, 2019):

Per Brian Candler on the mailing list:

OK, I can reproduce this now!

  • pick any device
  • add rearports using pattern [1-96]. Defaults for all other fields.
  • back at the device, select all rearports (using the checkbox which selects all)
  • select Edit
  • select type 100 Punch
  • click Apply

The page just refreshes.

Yes!! That's it!!

@kwoodVisions commented on GitHub (Feb 20, 2019): > Per Brian Candler on the mailing list: > > > OK, I can reproduce this now! > > > > * pick any device > > * add rearports using pattern [1-96]. Defaults for all other fields. > > * back at the device, select all rearports (using the checkbox which selects all) > > * select Edit > > * select type 100 Punch > > * click Apply > > > > The page just refreshes. Yes!! That's it!!
Author
Owner

@jeremystretch commented on GitHub (Feb 20, 2019):

Boy that's a weird one. Nice work! Found the issue:

class RearPortBulkEditForm(BootstrapMixin, AddRemoveTagsForm, BulkEditForm):
    pk = forms.ModelMultipleChoiceField(
        queryset=Interface.objects.all(),
        widget=forms.MultipleHiddenInput()
    )

The form is checking the specified primary keys against Interfaces instead of RearPorts.

@jeremystretch commented on GitHub (Feb 20, 2019): Boy that's a weird one. Nice work! Found the issue: ``` class RearPortBulkEditForm(BootstrapMixin, AddRemoveTagsForm, BulkEditForm): pk = forms.ModelMultipleChoiceField( queryset=Interface.objects.all(), widget=forms.MultipleHiddenInput() ) ``` The form is checking the specified primary keys against Interfaces instead of RearPorts.
Author
Owner

@kwoodVisions commented on GitHub (Feb 20, 2019):

Sneaky little bugger - I'm glad you found it in the code so quickly!

@kwoodVisions commented on GitHub (Feb 20, 2019): Sneaky little bugger - I'm glad you found it in the code so quickly!
Author
Owner

@jeremystretch commented on GitHub (Feb 20, 2019):

Fixed this and also added an error dump at the top of the page to hopefully make troubleshooting future bugs easier. Thanks again!

@jeremystretch commented on GitHub (Feb 20, 2019): Fixed this and also added an error dump at the top of the page to hopefully make troubleshooting future bugs easier. Thanks again!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2398