Fakultas Ilmu Komputer UI

Verified Commit f11b5fb4 authored by Giovan Isa Musthofa's avatar Giovan Isa Musthofa
Browse files

[GREEN] Add nested model handling on RegistrationFullSerializer

parent 617f34d5
Pipeline #38419 passed with stages
in 2 minutes and 23 seconds
......@@ -95,6 +95,15 @@ class RegistrationFullSerializer(RegistrationSerializer):
def create(self, validated_data):
user = super().create(validated_data)
profile_data = validated_data['profile']
for field in ('body_weight', 'id_card_no', 'birthplace', 'birthdate', 'sex',
'profession', 'blood_type', 'married_status', 'address',
'city', 'district', 'village', 'phone_no', 'work_address',
'work_email', 'work_phone_no'):
value = profile_data.get(field)
setattr(user.profile, field, value)
return user
class Meta:
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