Use new media server for invoices
This commit is contained in:
parent
ef3e3ad03e
commit
08b3c3dd18
3 changed files with 5 additions and 3 deletions
|
@ -93,7 +93,7 @@ class TransactionForm(ModelForm):
|
||||||
|
|
||||||
|
|
||||||
def invoice_path(instance, filename):
|
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):
|
class Invoice(models.Model):
|
||||||
|
|
|
@ -15,9 +15,11 @@
|
||||||
<div class="transaction {% cycle 'w' 'g' %}">
|
<div class="transaction {% cycle 'w' 'g' %}">
|
||||||
<span class="attach center">
|
<span class="attach center">
|
||||||
{% for invoice in trans.invoices %}
|
{% for invoice in trans.invoices %}
|
||||||
<a href="{% url "invoice" invoice.id %}">
|
{% spaceless %}
|
||||||
|
<a href="{{ invoice.file.url }}">
|
||||||
<i class="fa fa-paperclip"></i>
|
<i class="fa fa-paperclip"></i>
|
||||||
</a>
|
</a>
|
||||||
|
{% endspaceless %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</span>
|
</span>
|
||||||
<span class="date num center">{{ trans.date|date:"Y-m-d" }}</span>
|
<span class="date num center">{{ trans.date|date:"Y-m-d" }}</span>
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<div id="invoices">
|
<div id="invoices">
|
||||||
{% for inv in transaction.invoices %}
|
{% for inv in transaction.invoices %}
|
||||||
<div class="invoice">
|
<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 %}"
|
<a href="{% url 'del_invoice' transaction.id inv.id %}"
|
||||||
onclick="return confirm('{% translate "Delete" %} <{{ inv.name }}> ?')">
|
onclick="return confirm('{% translate "Delete" %} <{{ inv.name }}> ?')">
|
||||||
<i class="fa-regular fa-trash-can"></i>
|
<i class="fa-regular fa-trash-can"></i>
|
||||||
|
|
Loading…
Reference in a new issue