refactor to use django template string

This commit is contained in:
RubenPX 2022-03-17 19:23:36 +01:00
parent ed3ad7cda0
commit c1f25a73da
2 changed files with 2 additions and 2 deletions

View File

@ -27,7 +27,7 @@
{% for bill in object_list %} {% for bill in object_list %}
<tr> <tr>
<th scope="row">{{ bill.number }}</th> <th scope="row">{{ bill.number }}</th>
<td>{{ bill.created_on }}</td> <td>{{ bill.created_on|date:"d/m/Y" }}</td>
<td>{{ bill.type }}</td> <td>{{ bill.type }}</td>
<td>{{ bill.total|floatformat:2|localize }}€</td> <td>{{ bill.total|floatformat:2|localize }}€</td>
<td><a class="text-dark" href="{% url 'musician:bill-download' bill.id %}" target="_blank" rel="noopener noreferrer"><i class="fas fa-file-pdf"></i></a></td> <td><a class="text-dark" href="{% url 'musician:bill-download' bill.id %}" target="_blank" rel="noopener noreferrer"><i class="fas fa-file-pdf"></i></a></td>

View File

@ -183,7 +183,7 @@ class BillingView(ServiceListView):
qs = super().get_queryset() qs = super().get_queryset()
qs = sorted(qs, key=lambda x: x.created_on, reverse=True) qs = sorted(qs, key=lambda x: x.created_on, reverse=True)
for q in qs: for q in qs:
q.created_on = datetime.datetime.strptime(q.created_on, "%Y-%m-%d").strftime("%d/%m/%Y") q.created_on = datetime.datetime.strptime(q.created_on, "%Y-%m-%d")
return qs return qs