Skip to content

Commit

Permalink
feat: sw team serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhruv9449 committed Mar 16, 2024
1 parent 7703035 commit 50f03e2
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,31 @@ class Meta:
fields = ["username", "name", "is_faculty", "verified"]


class SWTeamSerializer(serializers.ModelSerializer):
role = serializers.SerializerMethodField()

class Meta:
model = User
fields = [
"username",
"name",
"email",
"phone_no",
"is_faculty",
"role",
"tenure",
]

def get_role(self, obj):
if obj.is_dsw:
return "dsw"
elif obj.is_adsw:
return "adsw"
elif obj.is_faculty:
return "faculty"
else:
return "student"

class UserAdminSerializer(serializers.ModelSerializer):
class Meta:
model = User
Expand Down

0 comments on commit 50f03e2

Please sign in to comment.