From c1f25a73da8e4b7c42f168f9316b3e615fe9f4d5 Mon Sep 17 00:00:00 2001 From: RubenPX Date: Thu, 17 Mar 2022 19:23:36 +0100 Subject: [PATCH] refactor to use django template string --- musician/templates/musician/billing.html | 2 +- musician/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/musician/templates/musician/billing.html b/musician/templates/musician/billing.html index d3ba915..e02c6b0 100644 --- a/musician/templates/musician/billing.html +++ b/musician/templates/musician/billing.html @@ -27,7 +27,7 @@ {% for bill in object_list %} {{ bill.number }} - {{ bill.created_on }} + {{ bill.created_on|date:"d/m/Y" }} {{ bill.type }} {{ bill.total|floatformat:2|localize }}€ diff --git a/musician/views.py b/musician/views.py index 3ab4265..ec3ac36 100644 --- a/musician/views.py +++ b/musician/views.py @@ -183,7 +183,7 @@ class BillingView(ServiceListView): qs = super().get_queryset() qs = sorted(qs, key=lambda x: x.created_on, reverse=True) 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