From 9deba5b28ffe8343441b63d3562e38f6ce3e91db Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Wed, 19 Apr 2023 17:19:01 +0200 Subject: [PATCH] Show file extension --- nummi/main/templates/main/form/fileinput.html | 4 +++- nummi/main/templates/main/table/invoice.html | 2 +- nummi/main/templatetags/main_extras.py | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/nummi/main/templates/main/form/fileinput.html b/nummi/main/templates/main/form/fileinput.html index 7d6d7bc..c9ffd65 100644 --- a/nummi/main/templates/main/form/fileinput.html +++ b/nummi/main/templates/main/form/fileinput.html @@ -1,9 +1,11 @@ +{% load i18n %} +{% load main_extras %} {% if widget.is_initial %} {% if not widget.required %} diff --git a/nummi/main/templates/main/table/invoice.html b/nummi/main/templates/main/table/invoice.html index 86506f1..bc3024b 100644 --- a/nummi/main/templates/main/table/invoice.html +++ b/nummi/main/templates/main/table/invoice.html @@ -18,7 +18,7 @@ {{ invoice.name }}
{{ widget.initial_text }} - Fichier + {% translate "File" %} [{{ widget.value|extension }}]
- {% translate "File" %} + {% translate "File" %} [{{ invoice.file|extension }}] {% translate "Delete" %} diff --git a/nummi/main/templatetags/main_extras.py b/nummi/main/templatetags/main_extras.py index 6cf7c9a..b1b67ff 100644 --- a/nummi/main/templatetags/main_extras.py +++ b/nummi/main/templatetags/main_extras.py @@ -45,3 +45,8 @@ def form_buttons(instance): @register.filter def remix(icon): return mark_safe(f"""""") + + +@register.filter +def extension(file): + return file.name.split(".")[-1].upper()