Skip to content

Commit

Permalink
chore: add student_id to profile API for teachers
Browse files Browse the repository at this point in the history
  • Loading branch information
alanzhu0 committed Sep 17, 2024
1 parent ce2e6bc commit 19e10d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions intranet/apps/users/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ def retrieve(self, request, *args, **kwargs):
"websites",
"is_announcements_admin",
]
if not (request.user.is_teacher or request.user.is_eighth_admin):
fields_to_remove.append("student_id")

for field in fields_to_remove:
data.pop(field)

Expand Down
2 changes: 2 additions & 0 deletions intranet/apps/users/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class UserSerializer(serializers.ModelSerializer):
user_type = serializers.CharField(max_length=100)
graduation_year = serializers.IntegerField()
tj_email = serializers.StringRelatedField()
student_id = serializers.IntegerField()
emails = serializers.StringRelatedField(many=True)
phones = serializers.StringRelatedField(many=True)
websites = serializers.StringRelatedField(many=True)
Expand All @@ -91,6 +92,7 @@ class Meta:
"last_name",
"nickname",
"tj_email",
"student_id",
"emails",
"grade",
"graduation_year",
Expand Down

0 comments on commit 19e10d3

Please sign in to comment.