Open grusirna opened 5 years ago
I think he means this (I can open a new issue if that's better). Explained with pseudo code because its usually better.
class Place(model):
name = CharField()
country = ForeignKey(Country, related_name='places')
class Country(model):
name = CharField()
Now defined a countries query as DjangoListObjectField.
A query like this
{
countries {
results {
places {
name
}
}
}
}
Fails saying PlaceType has no attribute get_queryset. When I defined a places field in the graphql type as a DjangoListObjectField, it does work. So it isn't a big issue.
But the problem there is that the library eagerly loads the place model, so you get duplicate sql queries on the Place model on the above query - Tested by installing nplusone library.
Fixed by adding a get_queryset method in DjangoObjectType.
Hi @grusirna, could you provide more info, please?