Fix receipt file name

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2024-03-02 19:44:35 +01:00
parent 4ff53e08db
commit 0530441452
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 2 additions and 1 deletions

View File

@ -767,7 +767,8 @@ class ReceiptView(LoginRequiredMixin, View):
mime_type = mime.from_file(path)
ext = mime_type.split("/")[1].replace("jpeg", "jpg")
# Replace file name
true_file_name = _("Payment receipt of {user}.{ext}").format(user=str(user.registration), ext=ext)
registrations = ", ".join(str(registration) for registration in payment.registrations.all())
true_file_name = _("Payment receipt of {registrations}.{ext}").format(registrations=registrations, ext=ext)
return FileResponse(open(path, "rb"), content_type=mime_type, filename=true_file_name)