Closed
Description
Related to #750. Appreciate the fix for this problem!!
Problem
When using filter_fields I get an error about using wrong types which started appearing in 2.4.0.
Variable "userEmail" of type "String" used in position expecting type "ID".
The error does not occur with graphene-django 2.3.2
Context
- using django-filter 2.2.0
- django 2.4.0
- graphene-django 2.6.0
model.py
class Membership(TimeStampedModel):
user = models.ForeignKey(User, on_delete=models.CASCADE)
tenant = models.ForeignKey(Tenant, on_delete=models.CASCADE)
class User(TimeStampedModel, AbstractBaseUser, PermissionsMixin):
email = EmailField(unique=True, verbose_name=_('email'))
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []
objects = UserManager()
Schema.py
class MembershipNode(DjangoObjectType):
class Meta:
model = Membership
filter_fields = {
'id': ['exact'],
'user__email': ['exact'],
}
interfaces = (MembershipNodeInterface,)
Query:
QUERY_MEMBERSHIPS = '''
query memberships($tenant: String!, $userEmail: String) {
memberships(tenant: $tenant, user_Email: $userEmail) {
edges {
node {
id
isFitter
isMonitor
isAdmin
isStaff
}
}
}
}
'''
Result:
Variable "userEmail" of type "String" used in position expecting type "ID".
Solution
Should be related to #750. Might be a special case due to the email
being the identifying field of the User
I am confident it is related to this PR: https://github.com/graphql-python/graphene-django/pull/682/files . In graphene_django/filter/utils.py the way how to retrieve the Type of a field was changed.
Keep on rocking :)
Metadata
Metadata
Assignees
Labels
No labels