From 46bc3ff0ff6f0a1891afb2a529822386460690e9 Mon Sep 17 00:00:00 2001 From: Nathan Chapman Date: Mon, 2 May 2022 19:40:15 -0600 Subject: [PATCH] Fixes --- src/ptcoffee/settings.py | 18 +++++++++++++----- src/static/styles/main.css | 7 +++++++ src/storefront/cart.py | 7 +++---- .../templates/storefront/order_detail.html | 7 +++++-- .../templates/storefront/product_list.html | 3 --- 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/ptcoffee/settings.py b/src/ptcoffee/settings.py index b77af13..793f7a5 100644 --- a/src/ptcoffee/settings.py +++ b/src/ptcoffee/settings.py @@ -195,13 +195,15 @@ if DEBUG: 'version': 1, 'disable_existing_loggers': False, 'formatters': { - 'standard': { - 'format': '%(asctime)s %(levelname)s %(name)s %(message)s' - }, + 'verbose': { + 'format': '{name} {levelname} {asctime} {module} {process:d} {thread:d} {message}', + 'style': '{', + } }, 'handlers': { 'console': { 'class': 'logging.StreamHandler', + 'formatter': 'verbose', }, }, 'root': { @@ -214,15 +216,21 @@ else: 'version': 1, 'disable_existing_loggers': False, 'formatters': { - 'standard': { - 'format': '%(asctime)s %(levelname)s %(name)s %(message)s' + 'verbose': { + 'format': '{name} {levelname} {asctime} {module} {process:d} {thread:d} {message}', + 'style': '{', }, + 'simple': { + 'format': '{levelname} {message}', + 'style': '{', + } }, 'handlers': { 'file': { 'level': 'DEBUG', 'class': 'logging.FileHandler', 'filename': '/var/log/django-ptcoffee/debug.log', + 'formatter': 'verbose', }, }, 'loggers': { diff --git a/src/static/styles/main.css b/src/static/styles/main.css index 137bb90..745fd84 100644 --- a/src/static/styles/main.css +++ b/src/static/styles/main.css @@ -804,6 +804,13 @@ article + article { margin-left: auto; } +/* ========================================================================== + Orders & OrderLines + ========================================================================== */ +.line__image { + max-width: 8rem; +} + diff --git a/src/storefront/cart.py b/src/storefront/cart.py index e05afe6..e07ef79 100644 --- a/src/storefront/cart.py +++ b/src/storefront/cart.py @@ -123,11 +123,10 @@ class Cart: usps = USPSApiWithRate(settings.USPS_USER_ID, test=True) validation = usps.get_rate(usps_rate_request) logger.info(validation.result) - try: + if not 'Error' in validation.result['RateV4Response']['Package']: rate = validation.result['RateV4Response']['Package']['Postage']['CommercialRate'] - rate = '0.00' - except KeyError as e: - raise e("USPS Result has no 'Postage'") + else: + logger.error("USPS Rate error") rate = '0.00' return Decimal(rate) else: diff --git a/src/storefront/templates/storefront/order_detail.html b/src/storefront/templates/storefront/order_detail.html index e1c45a4..629d452 100644 --- a/src/storefront/templates/storefront/order_detail.html +++ b/src/storefront/templates/storefront/order_detail.html @@ -23,9 +23,12 @@ {% with product=item.product %} - {{product.get_first_img.image}} + {{product.get_first_img.image}} + + + {{product.name}}
+ {{item.customer_note}} - {{product.name}} {{item.quantity}} ${{product.price}} ${{item.get_total}} diff --git a/src/storefront/templates/storefront/product_list.html b/src/storefront/templates/storefront/product_list.html index c069f91..302a3bc 100644 --- a/src/storefront/templates/storefront/product_list.html +++ b/src/storefront/templates/storefront/product_list.html @@ -1,8 +1,6 @@ {% extends 'base.html' %} {% load static %} -{% block head_title %}Shop | {% endblock %} - {% block head %} {% endblock %} @@ -10,7 +8,6 @@ {% block content %}

Organic Coffee, Slow Roasted, Italian Style

-

BETTER, Not BITTER