We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When using DjangoObjectType from graphene_django it is possible to reduce the fields by setting the fields in the Meta class.
graphene_django
fields
For example:
from graphene_django import DjangoObjectType class PerformanceType(DjangoObjectType): class Meta: model = Performance filter_fields = { "id": ("exact",), } fields = ( "id" )
As expected the output if I try and query something that is not the id:
{ "errors": [ { "message": "Cannot query field \"capacity\" on type \"PerformanceType\".", "locations": [ { "line": 33, "column": 6 } ] } ] }
However when using graphene_django_extras this is not working:
graphene_django_extras
When using the same snippet as above but with the import from graphene_django_extras import DjangoObjectType
from graphene_django_extras import DjangoObjectType
The output when querying not the id is:
{ "data": { "performances": [ { "capacity": null } ] } }
The expected would be the same as the original response (the error). Am I doing something wrong here?
The text was updated successfully, but these errors were encountered:
A workaround for this seems to be using only_fields instead of fields I couldn't spot this in the documentation but I may have missed it?
only_fields
I found only_fields in the graphene_django source and it seems to be depreciated so I'm not sure if this is a long-term solution?
Sorry, something went wrong.
No branches or pull requests
When using DjangoObjectType from
graphene_django
it is possible to reduce the fields by setting thefields
in the Meta class.For example:
As expected the output if I try and query something that is not the id:
However when using
graphene_django_extras
this is not working:When using the same snippet as above but with the import
from graphene_django_extras import DjangoObjectType
The output when querying not the id is:
The expected would be the same as the original response (the error). Am I doing something wrong here?
The text was updated successfully, but these errors were encountered: