<s> from __future__ import unicode_literals <EOL> from djangobmf import fields <EOL> from rest_framework . fields import CharField <EOL> from rest_framework . fields import DecimalField <EOL> from rest_framework . serializers import ModelSerializer <EOL> class ModuleSerializer ( ModelSerializer ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> self . request = kwargs . pop ( '<STR_LIT>' , None ) <EOL> super ( ModuleSerializer , self ) . __init__ ( * args , ** kwargs ) <EOL> def get_field_names ( self , * args , ** kwargs ) : <EOL> names = super ( ModuleSerializer , self ) . get_field_names ( * args , ** kwargs ) <EOL> if '<STR_LIT>' not in names : <EOL> names = ( '<STR_LIT>' , ) + tuple ( names ) <EOL> return names <EOL> class CountryField ( CharField ) : <EOL> def to_representation ( self , value ) : <EOL> return value . alpha3 <EOL> ModuleSerializer . serializer_field_mapping [ fields . CountryField ] = CountryField <EOL> class MoneyField ( DecimalField ) : <EOL> def to_representation ( self , value ) : <EOL> return value . value <EOL> ModuleSerializer . serializer_field_mapping [ fields . MoneyField ] = MoneyField <EOL> class WorkflowField ( CharField ) : <EOL> def to_representation ( self , value ) : <EOL> return value . key <EOL> ModuleSerializer . serializer_field_mapping [ fields . WorkflowField ] = WorkflowField </s>
