Project

General

Profile

Development #69031

Traitement, export csv/ods d'un formdata avec un bloc de champs qui contient des virgules

Added by Lauréline Guérin 5 months ago. Updated 5 months ago.

Status:
Nouveau
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
13 September 2022
Due date:
% Done:

0%

Estimated time:
Patch proposed:
No
Planning:
No

Description

    def get_spreadsheet_line(self, fields, data):
        elements = []
        for field in fields:
            element = data.get_field_view_value(field) or ''
            if getattr(field, 'block_field', None):
                nb_items = field.block_field.max_items or 1
                values = str(element).split(', ')
                for value in values + [''] * (nb_items - len(values)):
                    elements.append({'field': field, 'value': value, 'native_value': value})
                continue
            display_value = None
            if field.store_display_value:
                display_value = data.data.get('%s_display' % field.id) or ''
            for value in field.get_csv_value(element, display_value=display_value):
                elements.append({'field': field, 'value': value, 'native_value': element})
        return elements

values = str(element).split(', ') => si on a des virgules dans la valeur d'un champ du bloc de champs, on splitte n'importe comment


Related issues

Related to w.c.s. - Bug #62424: TypeError: join requires a list of stringsFermé04 March 2022

Actions

History

#2

Updated by Lauréline Guérin 5 months ago

  • Related to Bug #62424: TypeError: join requires a list of strings added

Also available in: Atom PDF