mirror of
https://github.com/ae-utbm/sith.git
synced 2025-11-10 05:53:06 +00:00
@@ -23,6 +23,7 @@
|
||||
#
|
||||
|
||||
import csv
|
||||
import itertools
|
||||
from typing import Any
|
||||
|
||||
from django.conf import settings
|
||||
@@ -37,7 +38,7 @@ from django.urls import reverse, reverse_lazy
|
||||
from django.utils import timezone
|
||||
from django.utils.safestring import SafeString
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import gettext as _t
|
||||
from django.utils.translation import gettext
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import DetailView, ListView, View
|
||||
from django.views.generic.edit import CreateView, DeleteView, UpdateView
|
||||
@@ -487,40 +488,40 @@ class ClubSellingCSVView(ClubSellingView):
|
||||
kwargs = self.get_context_data(**kwargs)
|
||||
|
||||
# Use the StreamWriter class instead of request for streaming
|
||||
pseudo_buffer = self.StreamWriter()
|
||||
writer = csv.writer(
|
||||
pseudo_buffer, delimiter=";", lineterminator="\n", quoting=csv.QUOTE_ALL
|
||||
)
|
||||
writer = csv.writer(self.StreamWriter())
|
||||
|
||||
writer.writerow([_t("Quantity"), kwargs["total_quantity"]])
|
||||
writer.writerow([_t("Total"), kwargs["total"]])
|
||||
writer.writerow([_t("Benefit"), kwargs["benefit"]])
|
||||
writer.writerow(
|
||||
first_rows = [
|
||||
[gettext("Quantity"), kwargs["total_quantity"]],
|
||||
[gettext("Total"), kwargs["total"]],
|
||||
[gettext("Benefit"), kwargs["benefit"]],
|
||||
[
|
||||
_t("Date"),
|
||||
_t("Counter"),
|
||||
_t("Barman"),
|
||||
_t("Customer"),
|
||||
_t("Label"),
|
||||
_t("Quantity"),
|
||||
_t("Total"),
|
||||
_t("Payment method"),
|
||||
_t("Selling price"),
|
||||
_t("Purchase price"),
|
||||
_t("Benefit"),
|
||||
]
|
||||
)
|
||||
gettext("Date"),
|
||||
gettext("Counter"),
|
||||
gettext("Barman"),
|
||||
gettext("Customer"),
|
||||
gettext("Label"),
|
||||
gettext("Quantity"),
|
||||
gettext("Total"),
|
||||
gettext("Payment method"),
|
||||
gettext("Selling price"),
|
||||
gettext("Purchase price"),
|
||||
gettext("Benefit"),
|
||||
],
|
||||
]
|
||||
|
||||
# Stream response
|
||||
response = StreamingHttpResponse(
|
||||
(
|
||||
writer.writerow(self.write_selling(selling))
|
||||
for selling in kwargs["result"]
|
||||
itertools.chain(
|
||||
(writer.writerow(r) for r in first_rows),
|
||||
(
|
||||
writer.writerow(self.write_selling(selling))
|
||||
for selling in kwargs["result"]
|
||||
),
|
||||
),
|
||||
content_type="text/csv",
|
||||
)
|
||||
name = _("Sellings") + "_" + self.object.name + ".csv"
|
||||
response["Content-Disposition"] = "filename=" + name
|
||||
name = f"{gettext('Sellings')}_{self.object.name}.csv"
|
||||
response["Content-Disposition"] = f"attachment; filename={name}"
|
||||
|
||||
return response
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-11-04 12:43+0100\n"
|
||||
"POT-Creation-Date: 2025-11-07 14:50+0100\n"
|
||||
"PO-Revision-Date: 2016-07-18\n"
|
||||
"Last-Translator: Maréchal <thomas.girod@utbm.fr\n"
|
||||
"Language-Team: AE info <ae.info@utbm.fr>\n"
|
||||
@@ -146,7 +146,7 @@ msgstr "Date de début"
|
||||
msgid "End date"
|
||||
msgstr "Date de fin"
|
||||
|
||||
#: club/forms.py club/templates/club/club_sellings.jinja
|
||||
#: club/forms.py club/templates/club/club_sellings.jinja club/views.py
|
||||
#: core/templates/core/user_account_detail.jinja
|
||||
#: counter/templates/counter/cash_summary_list.jinja counter/views/mixins.py
|
||||
msgid "Counter"
|
||||
@@ -409,7 +409,7 @@ msgstr "Total : "
|
||||
msgid "Benefit: "
|
||||
msgstr "Bénéfice : "
|
||||
|
||||
#: club/templates/club/club_sellings.jinja
|
||||
#: club/templates/club/club_sellings.jinja club/views.py
|
||||
#: core/templates/core/user_account_detail.jinja
|
||||
#: counter/templates/counter/cash_summary_list.jinja
|
||||
#: counter/templates/counter/last_ops.jinja
|
||||
@@ -419,34 +419,34 @@ msgstr "Bénéfice : "
|
||||
msgid "Date"
|
||||
msgstr "Date"
|
||||
|
||||
#: club/templates/club/club_sellings.jinja
|
||||
#: club/templates/club/club_sellings.jinja club/views.py
|
||||
#: core/templates/core/user_account_detail.jinja
|
||||
#: counter/templates/counter/last_ops.jinja
|
||||
msgid "Barman"
|
||||
msgstr "Barman"
|
||||
|
||||
#: club/templates/club/club_sellings.jinja
|
||||
#: club/templates/club/club_sellings.jinja club/views.py
|
||||
#: counter/templates/counter/counter_click.jinja
|
||||
#: counter/templates/counter/last_ops.jinja
|
||||
#: counter/templates/counter/refilling_list.jinja
|
||||
msgid "Customer"
|
||||
msgstr "Client"
|
||||
|
||||
#: club/templates/club/club_sellings.jinja
|
||||
#: club/templates/club/club_sellings.jinja club/views.py
|
||||
#: core/templates/core/user_account_detail.jinja
|
||||
#: counter/templates/counter/last_ops.jinja
|
||||
#: rootplace/templates/rootplace/logs.jinja
|
||||
msgid "Label"
|
||||
msgstr "Étiquette"
|
||||
|
||||
#: club/templates/club/club_sellings.jinja
|
||||
#: club/templates/club/club_sellings.jinja club/views.py
|
||||
#: core/templates/core/user_account_detail.jinja
|
||||
#: core/templates/core/user_stats.jinja
|
||||
#: counter/templates/counter/last_ops.jinja
|
||||
msgid "Quantity"
|
||||
msgstr "Quantité"
|
||||
|
||||
#: club/templates/club/club_sellings.jinja
|
||||
#: club/templates/club/club_sellings.jinja club/views.py
|
||||
#: core/templates/core/user_account.jinja
|
||||
#: core/templates/core/user_account_detail.jinja
|
||||
#: counter/templates/counter/cash_summary_list.jinja
|
||||
@@ -456,7 +456,7 @@ msgstr "Quantité"
|
||||
msgid "Total"
|
||||
msgstr "Total"
|
||||
|
||||
#: club/templates/club/club_sellings.jinja
|
||||
#: club/templates/club/club_sellings.jinja club/views.py
|
||||
#: core/templates/core/user_account_detail.jinja
|
||||
#: core/templates/core/user_detail.jinja
|
||||
#: counter/templates/counter/last_ops.jinja
|
||||
@@ -699,6 +699,18 @@ msgstr "Vous êtes maintenant membre de ce club."
|
||||
msgid "%(user)s has been added to club."
|
||||
msgstr "%(user)s a été ajouté au club."
|
||||
|
||||
#: club/views.py
|
||||
msgid "Benefit"
|
||||
msgstr "Bénéfice"
|
||||
|
||||
#: club/views.py
|
||||
msgid "Selling price"
|
||||
msgstr "Prix de vente"
|
||||
|
||||
#: club/views.py
|
||||
msgid "Purchase price"
|
||||
msgstr "Prix d'achat"
|
||||
|
||||
#: com/forms.py
|
||||
msgid "Format: 16:9 | Resolution: 1920x1080"
|
||||
msgstr "Format : 16:9 | Résolution : 1920x1080"
|
||||
|
||||
Reference in New Issue
Block a user