Show file extension
This commit is contained in:
parent
06b51a87ff
commit
9deba5b28f
3 changed files with 9 additions and 2 deletions
|
@ -1,9 +1,11 @@
|
|||
{% load i18n %}
|
||||
{% load main_extras %}
|
||||
<table class="file-input">
|
||||
{% if widget.is_initial %}
|
||||
<tr>
|
||||
<th>{{ widget.initial_text }}</th>
|
||||
<td>
|
||||
<a href="{{ widget.value.url }}">Fichier</a>
|
||||
<a href="{{ widget.value.url }}">{% translate "File" %} [{{ widget.value|extension }}]</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% if not widget.required %}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<a href="{{ invoice.get_absolute_url }}">{{ invoice.name }}</a>
|
||||
</th>
|
||||
<td>
|
||||
<a href="{{ invoice.file.url }}">{% translate "File" %}</a>
|
||||
<a href="{{ invoice.file.url }}">{% translate "File" %} [{{ invoice.file|extension }}]</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ invoice.get_delete_url }}">{% translate "Delete" %}
|
||||
|
|
|
@ -45,3 +45,8 @@ def form_buttons(instance):
|
|||
@register.filter
|
||||
def remix(icon):
|
||||
return mark_safe(f"""<span class="ri-{icon}-line"></span>""")
|
||||
|
||||
|
||||
@register.filter
|
||||
def extension(file):
|
||||
return file.name.split(".")[-1].upper()
|
||||
|
|
Loading…
Reference in a new issue