1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Corrected issue with duplicate queries

This commit is contained in:
Jeremy Stretch
2016-08-17 12:41:12 -04:00
parent c49177e59c
commit 8d99ad3099
2 changed files with 6 additions and 2 deletions

View File

@@ -339,7 +339,8 @@ class BulkEditView(View):
if form.cleaned_data[name] not in [None, u'']:
for pk in pk_list:
try:
cfv = CustomFieldValue.objects.get(field=form.fields[name].model, obj_type=obj_type, obj_id=pk)
cfv = CustomFieldValue.objects.select_related('field').get(field=form.fields[name].model,
obj_type=obj_type, obj_id=pk)
except CustomFieldValue.DoesNotExist:
cfv = CustomFieldValue(field=form.fields[name].model, obj_type=obj_type, obj_id=pk)
cfv.value = form.cleaned_data[name]