Reduce Query load on intruments query

This commit is contained in:
Lorenz Padberg 2024-04-29 11:11:17 +02:00
parent edf14400ac
commit 56624997da
2 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,6 @@ query InstrumentsQuery {
instruments { instruments {
id id
title title
contents
slug slug
language language
type { type {

View File

@ -100,8 +100,9 @@ class InstrumentQuery(object):
return None return None
def resolve_instruments(self, info, **kwargs): def resolve_instruments(self, info, **kwargs):
return BasicKnowledge.objects.all().order_by("title").live() return BasicKnowledge.objects.all().order_by("title").live().select_related("new_type",
"locale",
"new_type__category")
def resolve_instrument_types(self, info, **kwargs): def resolve_instrument_types(self, info, **kwargs):
return ( return (
InstrumentType.objects.filter(instruments__isnull=False) InstrumentType.objects.filter(instruments__isnull=False)