Skip to content

Instantly share code, notes, and snippets.

Created January 6, 2015 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/7463dce5b0bfcf9b6767 to your computer and use it in GitHub Desktop.
Save anonymous/7463dce5b0bfcf9b6767 to your computer and use it in GitHub Desktop.
class PersonSerializer (serializers.ModelSerializer):
person_profile = PersonProfileSerializer()
class Meta:
model = Person
fields = ('person_profile')
class PersonProfileSerializer(serializers.ModelSerializer):
class Meta:
model = PersonProfile
fields = ('interests', 'researchLines', 'loginName')
@rsandrini
Copy link

se o nome do campo person_profile na classe for diferente vc precisa explicitar com:
person_profile = PersonProfileSerializer(source='nomedocampo')

@gabrielfgularte
Copy link

A classe PersonProfileSerializer não deveria vir antes? Aqui tá reclamando disso pra mim...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment