Skip to content

Commit

Permalink
Optimize db queries count
Browse files Browse the repository at this point in the history
  • Loading branch information
awieckowski committed Feb 9, 2024
1 parent 467a389 commit 866cf36
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/ralph/data_center/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ class DataCenterAssetAdmin(
'service_env__service',
'service_env__environment',
'configuration_path',
'property_of'
]
raw_id_fields = [
'model', 'rack', 'service_env', 'parent', 'budget_info',
Expand Down Expand Up @@ -495,16 +496,6 @@ class DataCenterAssetAdmin(
}),
)

def get_queryset(self, request):
qs = super().get_queryset(request)
qs = qs.select_related('property_of')
return qs

def get_export_queryset(self, request):
qs = super().get_export_queryset(request)
qs = qs.select_related('property_of')
return qs

def get_multiadd_fields(self, obj=None):
multiadd_fields = [
{'field': 'sn', 'allow_duplicates': False},
Expand Down

0 comments on commit 866cf36

Please sign in to comment.