def get_export_row(self, serializer, instance):
     results = []
     representation = serializer.to_representation(instance=instance)
     for column_name, value in representation.items():
         field = serializer.fields[column_name]
         val = fields.to_string_representation(field, value)
         # TODO: Excel escaping should be done for Excel/CSV formats
         results.append(strings.excel_escape(val))
     return results
    def test_excel_escape(self):
        value_pairs = (
            ('1', '1'),
            ('=1', ' =1'),
            ('+1', ' +1'),
            ('-1', ' -1'),
            ('@1', ' @1'),
        )

        for value, expected in value_pairs:
            actual = strings.excel_escape(value)
            self.assertEqual(expected, actual)