Skip to content

Commit

Permalink
Merge pull request #1780 from explody/fix_1778
Browse files Browse the repository at this point in the history
Fix for #1778.
  • Loading branch information
jeremystretch authored Dec 20, 2017
2 parents a598035 + 1cebc12 commit 4d1e798
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion netbox/utilities/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,14 @@ class BulkCreateView(View):

def get(self, request):

# Set initial values for visible form fields from query args
initial = {}
for field in getattr(self.model_form._meta, 'fields', []):
if request.GET.get(field):
initial[field] = request.GET[field]

form = self.form()
model_form = self.model_form()
model_form = self.model_form(initial=initial)

return render(request, self.template_name, {
'obj_type': self.model_form._meta.model._meta.verbose_name,
Expand Down

0 comments on commit 4d1e798

Please sign in to comment.