Last active
March 29, 2023 04:21
-
-
Save lordsarcastic/d627c06a83df870c1c17fb5b8fd73cd6 to your computer and use it in GitHub Desktop.
Return more information for user on signup in Django Djoser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from djoser import serializers as djoser_serializers | |
class UserCreateSerializer(djoser_serializers.UserCreateSerializer): | |
class Meta(djoser_serializers.UserCreateSerializer.Meta): | |
""" | |
Serializer handling user creation from Djoser. We customize | |
because we want the names to be consistent | |
""" | |
fields = ("username", "email", "is_verified", "uuid", "password") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Djoser settings | |
DJOSER = { | |
# rest of config | |
"SERIALIZERS": { | |
"user_create": "users.serializers.UserCreateSerializer" | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment