mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-17 06:19:24 +08:00
Improved custom user serializer
This commit is contained in:
parent
1e83f74217
commit
ac268cb4c8
1 changed files with 4 additions and 0 deletions
|
@ -13,11 +13,15 @@ from django.contrib.auth.password_validation import validate_password
|
|||
class CustomUserSerializer(BaseUserSerializer):
|
||||
user_status = StudentStatusSerializer(
|
||||
source='studentstatus', read_only=True)
|
||||
course = serializers.StringRelatedField()
|
||||
year_level = serializers.StringRelatedField()
|
||||
semester = serializers.StringRelatedField()
|
||||
|
||||
class Meta(BaseUserSerializer.Meta):
|
||||
model = CustomUser
|
||||
fields = ('username', 'email',
|
||||
'student_id_number', 'year_level', 'semester', 'course', 'subjects', 'avatar', 'first_name', 'last_name', 'is_banned', 'user_status')
|
||||
read_only_fields = ('is_banned', 'user_status')
|
||||
|
||||
# The model from your custom user
|
||||
|
||||
|
|
Loading…
Reference in a new issue