From d8e9e6f7144e6c8a31cbaafe31f48932922d19d3 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Tue, 2 Apr 2019 09:56:29 +0200 Subject: [PATCH] Display product weigth when available --- copanier/models.py | 7 +++++++ copanier/static/app.css | 7 ++++++- copanier/templates/delivery.html | 4 ++-- copanier/templates/place_order.html | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/copanier/models.py b/copanier/models.py index 5246a2f..306e6d4 100644 --- a/copanier/models.py +++ b/copanier/models.py @@ -97,6 +97,13 @@ class Product(Base): url: str = "" img: str = "" + @property + def label(self): + out = self.name + if self.weight: + out += f" ({self.weight})" + return out + @dataclass class ProductOrder(Base): diff --git a/copanier/static/app.css b/copanier/static/app.css index f925cf0..d7a4028 100644 --- a/copanier/static/app.css +++ b/copanier/static/app.css @@ -317,8 +317,13 @@ th.price { th.amount { width: 5rem; } -th.ref { +.ref { width: 5rem; + text-align: left; +} +td.ref { + font-weight: 300; + font-style: normal; } td.total, th.total { diff --git a/copanier/templates/delivery.html b/copanier/templates/delivery.html index 5d1e34a..833c961 100644 --- a/copanier/templates/delivery.html +++ b/copanier/templates/delivery.html @@ -23,8 +23,8 @@ {% for product in delivery.products %} - {{ product.ref }} - {{ product.name }} + {{ product.ref }} + {{ product.label }} {{ product.price }} € {{ delivery.product_wanted(product) }} {% for email, order in delivery.orders.items() %} diff --git a/copanier/templates/place_order.html b/copanier/templates/place_order.html index c9d5138..c9cb49d 100644 --- a/copanier/templates/place_order.html +++ b/copanier/templates/place_order.html @@ -9,7 +9,7 @@ ProduitPrixQuantité {% for product in delivery.products %} - {{ product.name }} + {{ product.label }} {% if product.description or product.img %} {% with unique_id=loop.index %} {% include "includes/modal_product.html" %}