Skip to content

Instantly share code, notes, and snippets.

@akshar-raaj
Created July 22, 2019 20:12
Show Gist options
  • Select an option

  • Save akshar-raaj/d593e9a432920251197ca580df9f128c to your computer and use it in GitHub Desktop.

Select an option

Save akshar-raaj/d593e9a432920251197ca580df9f128c to your computer and use it in GitHub Desktop.
class UserSerializer(serializers.ModelSerializer):
first_name = serializers.SerializerMethodField()
def get_first_name(self, obj):
return obj.first_name.title()
class Meta:
model = User
fields = ('email', 'first_name', 'last_name')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment