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

attribute check handled to avoid exception during module import #182

Conversation

jerinpetergeorge
Copy link
Contributor

Fixes #181

@Luctia
Copy link

Luctia commented Nov 30, 2020

Thanks for this! I do see that you've left in first_name and last_name. While I haven't tested this, I expect this will result in a similar error described in #181.

@jerinpetergeorge
Copy link
Contributor Author

During module initialization, Python evaluated the UserModel.USERNAME_FIELD statement and it couldn't find an attribute named USERNAME_FIELD and hence the error. Arbitrary you can add anything to the field section of the serializer and Django/DRF will not raise any exceptions unless the serializer instance initialized or evaluated.

So, here (afaik) Django will not raise any exceptions during module loading. @Luctia

@iMerica
Copy link
Owner

iMerica commented Dec 2, 2020

👍

@iMerica iMerica merged commit 7afb1df into iMerica:master Dec 2, 2020
@jerinpetergeorge jerinpetergeorge deleted the 181-attribute-error-while-importing-classes-from-dj_rest_auth-serializers.py branch December 2, 2020 04:41
@jerinpetergeorge
Copy link
Contributor Author

@iMerica I think we should do a patch release of this, coz I feel this is a critical one 😉

@iMerica
Copy link
Owner

iMerica commented Dec 4, 2020

2.1.2 is now out. Thank you!

https://pypi.org/project/dj-rest-auth/

@jerinpetergeorge
Copy link
Contributor Author

Hi @Luctia, now you can upgrade the dj-rest-auth package and I hope it won't trouble you this time :)

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

Successfully merging this pull request may close these issues.

USER_DETAILS_SERIALIZER setting not being detected
3 participants