diff --git a/codeforlife/user/serializers/user.py b/codeforlife/user/serializers/user.py index 121597ca..febac0a7 100644 --- a/codeforlife/user/serializers/user.py +++ b/codeforlife/user/serializers/user.py @@ -11,15 +11,9 @@ # pylint: disable-next=missing-class-docstring class UserSerializer(ModelSerializer[User]): - student = StudentSerializer( - source="new_student", - read_only=True, - ) + student = StudentSerializer(source="new_student") - teacher = TeacherSerializer( - source="new_teacher", - read_only=True, - ) + teacher = TeacherSerializer(source="new_teacher") # pylint: disable-next=missing-class-docstring,too-few-public-methods class Meta: @@ -35,6 +29,8 @@ class Meta: "date_joined", ] extra_kwargs = { + "student": {"read_only": True}, + "teacher": {"read_only": True}, "id": {"read_only": True}, "first_name": {"read_only": True}, "last_name": {"read_only": True},