13757 do prefetch to work around Django issue with vars in init (DeviceType)

This commit is contained in:
Arthur 2023-09-18 09:38:19 -07:00
parent 6939bf8aed
commit 382a592aaa

View File

@ -467,7 +467,11 @@ class TagBulkDeleteView(generic.BulkDeleteView):
#
class ConfigContextListView(generic.ObjectListView):
queryset = ConfigContext.objects.all()
queryset = ConfigContext.objects.all().prefetch_related(
'regions', 'site_groups', 'sites', 'locations', 'device_types',
'roles', 'platforms', 'cluster_types', 'cluster_groups', 'clusters',
'tenant_groups', 'tenants', 'tags',
)
filterset = filtersets.ConfigContextFilterSet
filterset_form = forms.ConfigContextFilterForm
table = tables.ConfigContextTable
@ -515,12 +519,20 @@ class ConfigContextView(generic.ObjectView):
@register_model_view(ConfigContext, 'edit')
class ConfigContextEditView(generic.ObjectEditView):
queryset = ConfigContext.objects.all()
queryset = ConfigContext.objects.all().prefetch_related(
'regions', 'site_groups', 'sites', 'locations', 'device_types',
'roles', 'platforms', 'cluster_types', 'cluster_groups', 'clusters',
'tenant_groups', 'tenants', 'tags',
)
form = forms.ConfigContextForm
class ConfigContextBulkEditView(generic.BulkEditView):
queryset = ConfigContext.objects.all()
queryset = ConfigContext.objects.all().prefetch_related(
'regions', 'site_groups', 'sites', 'locations', 'device_types',
'roles', 'platforms', 'cluster_types', 'cluster_groups', 'clusters',
'tenant_groups', 'tenants', 'tags',
)
filterset = filtersets.ConfigContextFilterSet
table = tables.ConfigContextTable
form = forms.ConfigContextBulkEditForm