Skip to content

Instantly share code, notes, and snippets.

@andrewkowalik
Last active August 29, 2015 14:02
Show Gist options
  • Save andrewkowalik/d8bbdd08517cca75ff9b to your computer and use it in GitHub Desktop.
Save andrewkowalik/d8bbdd08517cca75ff9b to your computer and use it in GitHub Desktop.
class Foobar(serializers.ModelSerializer):
company_type = serializers.SerializerMethodField('get_company_type')
company_code = serializers.Field(source='id')
class Meta:
model = Customer
fields = ('id')
def get_company_type(self):
return 'consumer'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment