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

Work with custom user #114

Open
1 of 7 tasks
alfredogama opened this issue May 20, 2021 · 2 comments
Open
1 of 7 tasks

Work with custom user #114

alfredogama opened this issue May 20, 2021 · 2 comments

Comments

@alfredogama
Copy link

Prerequisites

  • Is it a bug?
  • Is it a new feature?
  • Is it a a question?
  • Can you reproduce the problem?
  • Are you running the latest version?
  • Did you check for similar issues?
  • Did you perform a cursory search?

For more information, see the CONTRIBUTING guide.

Description

Hello Pedro,
I have a custom user, now the username is the email, but Im getting the error 'Meta.fields' must not contain non-model field names: username, I follow your recommendations but no success. I reproduced your demo here: https://github.com/alfredogama/graphql-with-auth.

Steps to Reproduce

1 clone your demo sample
2 use a custom User
3 start the graphi (http://127.0.0.1:8000/graphql)

Expected behavior

Open the Graphi

Actual behavior

I got an error:
TypeError at /graphql
'Meta.fields' must not contain non-model field names: username

Requirements

aniso8601==7.0.0
asgiref==3.3.1
Django==3.1.4
django-filter==2.4.0
django-graphql-auth==0.3.15
django-graphql-jwt==0.3.0
graphene==2.1.8
graphene-django==2.13.0
graphql-core==2.3.2
graphql-relay==2.0.1
promise==2.3
PyJWT==1.7.1
pytz==2020.4
Rx==1.6.1
singledispatch==3.4.0.3
six==1.15.0
sqlparse==0.4.1
text-unidecode==1.3
Unidecode==1.1.1

@0xZakk
Copy link

0xZakk commented Jun 23, 2021

@PedroBern I'm getting this same error too. Am I missing something?

@HellWolf93
Copy link

Try GRAPHQL_AUTH config on settings.py.

Example:

GRAPHQL_AUTH = {
    'LOGIN_ALLOWED_FIELDS': ['email'], # use email field for login
    'REGISTER_MUTATION_FIELDS': ['email', 'first_name'], # fields for register mutation
    'USERNAME_FIELD' : ['email'], 
    # the next option should solve your problems, tell 'django-filter' which fields to filter
    'USER_NODE_FILTER_FIELDS': { 
        "email": ["exact",],
        "is_active": ["exact"],
        "status__archived": ["exact"],
        "status__verified": ["exact"],
        "status__secondary_email": ["exact"],
    }
}

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

3 participants