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

How to filter QuerySet in DjangoSerializerType ? #166

Open
kentuck13 opened this issue Feb 25, 2021 · 0 comments
Open

How to filter QuerySet in DjangoSerializerType ? #166

kentuck13 opened this issue Feb 25, 2021 · 0 comments

Comments

@kentuck13
Copy link

I have articles. Each user must be read only their own articles. -> Articles.objects.filter(user=request.user)


class ArticleModelType(DjangoSerializerType):
    class Meta:
        filter_fields = {
            'name': ['exact'],
            'category': ['exact'],
            'category__name': ['exact']
        }
        serializer_class = ArticleSerializer

class Query(graphene.ObjectType):
    article, articles = ArticleModelType.QueryFields()

I still haven't found a place where I should put this QuerySet = Articles.objects.filter(user=request.user)

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