From 150632e9c544a32806eca01e748ae901a7963d7c Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Mon, 25 Apr 2022 18:37:26 +0200 Subject: [PATCH] Refactor price with database queries and start reports --- src/checkout/settings.py | 1 + src/common/templates/common/navbar.html | 3 + src/purchase/admin.py | 27 +++++-- src/purchase/layout.py | 2 +- src/purchase/models.py | 81 +++++++++---------- .../templates/purchase/basket_form.html | 4 +- .../templates/purchase/basket_list.html | 3 +- src/purchase/templates/purchase/reports.html | 19 +++++ .../purchase/{ => snippets}/basket_item.html | 0 .../purchase/snippets/report_products.html | 18 +++++ src/purchase/templatetags/__init__.py | 0 src/purchase/templatetags/purchase.py | 10 +++ src/purchase/urls.py | 2 + src/purchase/views/__init__.py | 3 + src/purchase/{views.py => views/basket.py} | 11 +-- src/purchase/views/reports.py | 20 +++++ src/purchase/views/utils.py | 5 ++ 17 files changed, 152 insertions(+), 57 deletions(-) create mode 100644 src/purchase/templates/purchase/reports.html rename src/purchase/templates/purchase/{ => snippets}/basket_item.html (100%) create mode 100644 src/purchase/templates/purchase/snippets/report_products.html create mode 100644 src/purchase/templatetags/__init__.py create mode 100644 src/purchase/templatetags/purchase.py create mode 100644 src/purchase/views/__init__.py rename src/purchase/{views.py => views/basket.py} (86%) create mode 100644 src/purchase/views/reports.py create mode 100644 src/purchase/views/utils.py diff --git a/src/checkout/settings.py b/src/checkout/settings.py index c0a8a5a..d468963 100644 --- a/src/checkout/settings.py +++ b/src/checkout/settings.py @@ -86,6 +86,7 @@ INSTALLED_APPS = [ "purchase", "crispy_forms", "crispy_bootstrap5", + "django_extensions", ] MIDDLEWARE = [ diff --git a/src/common/templates/common/navbar.html b/src/common/templates/common/navbar.html index cc00577..7e4989e 100644 --- a/src/common/templates/common/navbar.html +++ b/src/common/templates/common/navbar.html @@ -15,6 +15,9 @@ + {% endif %} {% if user.is_staff %}