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 {
id
title
contents
slug
language
type {

View File

@ -100,8 +100,9 @@ class InstrumentQuery(object):
return None
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):
return (
InstrumentType.objects.filter(instruments__isnull=False)