Fakultas Ilmu Komputer UI

Commit 27bfd769 authored by emil farisan's avatar emil farisan
Browse files

edit serializer to handle hackerrank link on profile page

parent 37c6dffa
......@@ -19,7 +19,7 @@ class StudentSerializer(serializers.ModelSerializer):
class Meta:
model = Student
fields = ['id', 'name', 'user', 'npm', 'resume', 'phone_number', 'birth_place', 'birth_date', 'major', 'batch', \
'show_transcript', 'photo', 'accepted_no', 'linkedin_url', 'region', 'intro']
'show_transcript', 'photo', 'accepted_no', 'linkedin_url', 'hackerrank_url', 'region', 'intro']
def get_accepted_no(self, obj):
apps = Application.objects.filter(student=obj, status=4)
......@@ -46,6 +46,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'show_transcript': instance.show_transcript,
'intro': instance.intro,
'linkedin_url' : instance.linkedin_url,
'hackerrank_url': instance.hackerrank_url,
def update(self, instance, validated_data):
......@@ -57,13 +58,14 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
instance.user.email = validated_data.get('email', instance.user.email)
instance.intro = validated_data.get('intro', instance.intro)
instance.linkedin_url = validated_data.get('linkedin_url', instance.linkedin_url)
instance.hackerrank_url = validated_data.get('hackerrank_url', instance.hackerrank_url)
return instance
class Meta:
model = Student
fields = ['resume', 'email', 'phone_number', 'photo', 'show_transcript', 'linkedin_url', 'region', 'intro']
fields = ['resume', 'email', 'phone_number', 'photo', 'show_transcript', 'linkedin_url', 'hackerrank_url' 'region', 'intro']
class CompanyUpdateSerializer(serializers.ModelSerializer):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment