In django-rest-auth they have a default defaul serializer for user models
t
USER_DETAILS_SERIALIZER = 'rest_auth.views.UserDetailsView'
And here they serialize djang.contrib.auth.User
In your case, you are using the user model of the user, and you do not have the usernam field in your models, so it gives an error when trying to serialize the user name of the field. Therefore, you need to write a serializer for your user model and add a path to your settings:
Example:
class CustomUserDetailsSerializer(serializers.ModelSerializer): class Meta: model = MyUser fields = ('email',) read_only_fields = ('email',)
In settings.py
USER_DETAILS_SERIALIZER = CustomUserDetailsSerializer
source share