Allow updating emails

This commit is contained in:
Tanner Collin 2020-01-12 00:34:22 +00:00
parent 3ff81633a7
commit f937dfdbce
2 changed files with 10 additions and 0 deletions

View File

@ -2,6 +2,7 @@ from django.contrib.auth.models import User, Group
from rest_framework import serializers from rest_framework import serializers
from rest_framework.exceptions import ValidationError from rest_framework.exceptions import ValidationError
from rest_auth.registration.serializers import RegisterSerializer from rest_auth.registration.serializers import RegisterSerializer
from rest_auth.serializers import UserDetailsSerializer
from uuid import uuid4 from uuid import uuid4
from PIL import Image from PIL import Image
@ -48,6 +49,11 @@ class UserTrainingSerializer(serializers.ModelSerializer):
exclude = ['user'] exclude = ['user']
depth = 2 depth = 2
class UserDetailsSerializer(UserDetailsSerializer):
class Meta:
model = User
fields = ['username', 'email']
class UserSerializer(serializers.ModelSerializer): class UserSerializer(serializers.ModelSerializer):
training = UserTrainingSerializer(many=True) training = UserTrainingSerializer(many=True)

View File

@ -175,6 +175,10 @@ REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': DEFAULT_AUTHENTICATION_CLASSES, 'DEFAULT_AUTHENTICATION_CLASSES': DEFAULT_AUTHENTICATION_CLASSES,
} }
REST_AUTH_SERIALIZERS = {
'USER_DETAILS_SERIALIZER': 'apiserver.api.serializers.UserDetailsSerializer'
}
LOGGING = { LOGGING = {
'version': 1, 'version': 1,
'formatters': { 'formatters': {