Open patrick91 opened 1 year ago
I like this! :)
My only suggestion here would be to receive the queryset as a callable instead of the queryset directly. The queryset has some stateful behaviours, meaning that if we are using the same one all the time it might product some weird issues.
That could either be a queryset: Callable[[], QuerySet]
or queryset: Callable[[Info], QuerySet]
. Probably the second one is better, which allows some common dynamic usage, like filtering it by the current user, etc
this is currently be done with the resolver and afterward is get_queryset of in my case ContentNode (the graphql pendant to Content) applied. What is the advantage of the new way?
e.g.
@strawberry_django.connection(strawberry.relay.ListConnection[ContentNode])
def contents(
self,
info: Info,
):
return Content.objects.all()
Passing a callable would be the same as using a resolver, so what @devkral mentioned 😊
I think we could keep it simple and only allow static querysets, as a convenience feature :)
Similar to what we do for filters, we could allow people to add a static qs to fields:
Upvote & Fund