Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefetch related in custom resolver #48

Open
p02diada opened this issue Jun 3, 2020 · 0 comments
Open

Prefetch related in custom resolver #48

p02diada opened this issue Jun 3, 2020 · 0 comments

Comments

@p02diada
Copy link

p02diada commented Jun 3, 2020

Hi, there is a way to improve the performance of a custom resolver like this one? I could not find it.

`

class MatchType(DjangoObjectType):
    accepted_attendances = graphene.Int()


class Meta:
    name = 'match'
    model = Match
    interfaces = (CustomNode,)
    connection_class = CountableConnectionBase
    only_fields = [
        'attendances',
    ]

    filter_fields = {
        'datetime': ['gte'],
    }

def resolve_accepted_attendances(self, info):
    return self.attendances.filter(status=AttendanceStatusConstants.ACCEPTED).count()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant