mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 12:12:53 -06:00
#4295 follow-up: Tweak handling of initial data for bulk edit forms
This commit is contained in:
parent
c7b74b2090
commit
7b6bd75c22
@ -716,9 +716,15 @@ class BulkEditView(GetReturnURLMixin, View):
|
|||||||
messages.error(self.request, "{} failed validation: {}".format(obj, e))
|
messages.error(self.request, "{} failed validation: {}".format(obj, e))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Pass GET parameters as initial data for the form, and include the PK list
|
# Include the PK list as initial data for the form
|
||||||
initial_data = request.GET.copy()
|
initial_data = {'pk': pk_list}
|
||||||
initial_data.update({'pk': pk_list})
|
|
||||||
|
# Check for other contextual data needed for the form. We avoid passing all of request.GET because the
|
||||||
|
# filter values will conflict with the bulk edit form fields.
|
||||||
|
# TODO: Find a better way to accomplish this
|
||||||
|
if 'device' in request.GET:
|
||||||
|
initial_data['device'] = request.GET.get('device')
|
||||||
|
|
||||||
form = self.form(model, initial=initial_data)
|
form = self.form(model, initial=initial_data)
|
||||||
|
|
||||||
# Retrieve objects being edited
|
# Retrieve objects being edited
|
||||||
|
Loading…
Reference in New Issue
Block a user