forked from I-deul-of-zoo/wanted-feed-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
################ - views.py 예외처리 추가 - UserSerializer 변경 -> 이메일 변경방지 ################ I-deul-of-zoo#4
- Loading branch information
Showing
2 changed files
with
38 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
from rest_framework import serializers | ||
from .models import User | ||
|
||
class UserSerializer(serializers.ModelSerializer): | ||
class UserCreateSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = User | ||
fields = ['username', 'email', 'auth_code'] | ||
extra_kwargs = { | ||
'email': {'read_only': True}, | ||
} | ||
fields = ['username', 'email', 'password'] | ||
|
||
class UserCreateSerializer(serializers.ModelSerializer): | ||
|
||
class UserSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = User | ||
fields = ['username', 'email', 'password', 'auth_code'] | ||
extra_kwargs = { | ||
'auth_code': {'read_only': True}, | ||
} | ||
fields = ['username', 'email', 'auth_code'] | ||
read_only_fields = ['email'] |
This file contains 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