<s> """<STR_LIT>""" <EOL> from rest_framework import serializers <EOL> def create_translated_fields_serializer ( shared_model , meta = None , related_name = None , ** fields ) : <EOL> """<STR_LIT>""" <EOL> if not related_name : <EOL> translated_model = shared_model . _parler_meta . root_model <EOL> else : <EOL> translated_model = shared_model . _parler_meta [ related_name ] . model <EOL> if not meta : <EOL> meta = { } <EOL> meta [ '<STR_LIT>' ] = translated_model <EOL> meta . setdefault ( '<STR_LIT>' , [ '<STR_LIT>' ] + translated_model . get_translated_fields ( ) ) <EOL> attrs = { } <EOL> attrs . update ( fields ) <EOL> attrs [ '<STR_LIT:Meta>' ] = type ( '<STR_LIT:Meta>' , ( ) , meta ) <EOL> return type ( '<STR_LIT>' . format ( translated_model . __name__ ) , ( serializers . ModelSerializer , ) , attrs ) </s>
