From 2c131489bc9191e26915a5cd11e8b8f534866086 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Tue, 18 Jul 2023 00:36:13 +0800 Subject: [PATCH] Improved student serializer --- stude/accounts/serializers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stude/accounts/serializers.py b/stude/accounts/serializers.py index a50b617..4036c84 100644 --- a/stude/accounts/serializers.py +++ b/stude/accounts/serializers.py @@ -31,7 +31,8 @@ class CustomUserSerializer(BaseUserSerializer): model = CustomUser fields = ('username', 'email', 'student_id_number', 'year_level', 'yearlevel_shortname', 'semester', 'semester_shortname', 'course', 'course_shortname', 'subjects', 'avatar', 'first_name', 'last_name', 'is_banned') - read_only_fields = ('is_banned', 'user_status') + read_only_fields = ('is_banned', 'user_status', 'yearlevel_shortname', + 'semester_shortname', 'course_shortname') def get_course_shortname(self, instance): return instance.course.shortname if instance.course else None