Skip to content

Commit

Permalink
fix: csv export
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-filicetti committed Mar 29, 2024
1 parent a2a5d3f commit 3cdd889
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions uniticket/uni_ticket/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,12 @@ def disabled_expired_items(items):

def export_input_module_csv(
module,
delimiter="$",
quotechar='"',
dialect="excel",
dialect="unix",
ticket_codes_list=[],
file_name="export.csv",
delimiter =',',
quotechar ='"',
quoting=csv.QUOTE_ALL
):

module.ticket_category
Expand Down Expand Up @@ -566,7 +567,11 @@ def export_input_module_csv(
csv_file["Content-Disposition"] = 'attachment; filename="{}"'.format(
file_name)
writer = csv.writer(
csv_file, dialect=dialect, delimiter=delimiter, quotechar=quotechar
csv_file,
dialect=dialect,
delimiter=delimiter,
quotechar=quotechar,
quoting=quoting
)

writer.writerow(head)
Expand Down Expand Up @@ -606,9 +611,9 @@ def export_input_module_csv(
found = re.search(settings.FORMSET_REGEX.format(name), k)
if found:
if for_index != 0:
match_list += "\n"
match_list += "\r\n"
if int(found.group("index")) > formset_index:
match_list += "\n"
match_list += "\r\n"
formset_index += 1
for_index += 1
match_list += "{}: {}".format(found.group("name"), v)
Expand Down

0 comments on commit 3cdd889

Please sign in to comment.