Use new media server for invoices

This commit is contained in:
Edgar P. Burkhart 2022-12-21 15:32:51 +01:00
parent ef3e3ad03e
commit 08b3c3dd18
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
3 changed files with 5 additions and 3 deletions

View file

@ -93,7 +93,7 @@ class TransactionForm(ModelForm):
def invoice_path(instance, filename):
return pathlib.Path("invoices", str(instance.id), filename)
return pathlib.Path("invoices", str(instance.id)).with_suffix(".pdf")
class Invoice(models.Model):

View file

@ -15,9 +15,11 @@
<div class="transaction {% cycle 'w' 'g' %}">
<span class="attach center">
{% for invoice in trans.invoices %}
<a href="{% url "invoice" invoice.id %}">
{% spaceless %}
<a href="{{ invoice.file.url }}">
<i class="fa fa-paperclip"></i>
</a>
{% endspaceless %}
{% endfor %}
</span>
<span class="date num center">{{ trans.date|date:"Y-m-d" }}</span>

View file

@ -24,7 +24,7 @@
<div id="invoices">
{% for inv in transaction.invoices %}
<div class="invoice">
<a href="{% url 'invoice' inv.id %}">{{ inv.name }}</a>
<a href="{{ inv.file.url }}">{{ inv.name }}</a>
<a href="{% url 'del_invoice' transaction.id inv.id %}"
onclick="return confirm('{% translate "Delete" %} <{{ inv.name }}> ?')">
<i class="fa-regular fa-trash-can"></i>