This commit is contained in:
Mohammad Shahrukh 2018-04-23 13:34:46 +00:00 committed by GitHub
commit fd64ffdf97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -312,8 +312,8 @@ The following example demonstrates how you might handle creating a user with a n
def create(self, validated_data):
profile_data = validated_data.pop('profile')
user = User.objects.create(**validated_data)
Profile.objects.create(user=user, **profile_data)
profile = Profile.objects.create(**profile_data)
user = User.objects.create(profile=profile, **validated_data)
return user
#### Writing `.update()` methods for nested representations