Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions netbox/netbox/views/generic/bulk_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,9 @@ def post(self, request, **kwargs):
elif 'virtual_machine' in request.GET:
initial_data['virtual_machine'] = request.GET.get('virtual_machine')

form = self.form(request.POST, initial=initial_data)
post_data = request.POST.copy()
post_data.setlist('pk', pk_list)
form = self.form(post_data, initial=initial_data)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could argue that pk_list no longer needs to be set in initial_data anymore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave it for now as there are a few scattered instances of it being referenced (in InterfaceBulkEditForm, for instance), perhaps incorrectly.

restrict_form_fields(form, request.user)

if '_apply' in request.POST:
Expand Down Expand Up @@ -700,10 +702,6 @@ def post(self, request, **kwargs):
else:
logger.debug("Form validation failed")

else:
form = self.form(initial=initial_data)
restrict_form_fields(form, request.user)

# Retrieve objects being edited
table = self.table(self.queryset.filter(pk__in=pk_list), orderable=False)
if not table.rows:
Expand Down