A
A
albertalexandrov2020-09-25 15:40:29
Django
albertalexandrov, 2020-09-25 15:40:29

Error "type object 'GenericType' has no attribute 'get_queryset'"?

I'm trying to display a list of users using GraphQL. I'm using the graphene-django-extras library (latest 0.4.9) .

import graphene
from django.contrib.auth import get_user_model
from graphene_django_extras import DjangoListObjectType, DjangoListObjectField


class UserListType(DjangoListObjectType):
    class Meta:
        model = get_user_model()


class Query(graphene.ObjectType):
    all_users = DjangoListObjectField(UserListType)


I get the error:

5f6de4dc7a561250886483.png

I believe the User model is expected to have a get_queryset() method. What could be the problem here?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question