From b3599d8241d32483497a36f88c3ffdc39f798ca8 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 3 Mar 2017 15:08:00 -0800 Subject: [PATCH] Add 'discontinued' flag to product view Also, don't render product description as link if it's empty --- tailbone/templates/products/view.mako | 1 + tailbone/views/products.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tailbone/templates/products/view.mako b/tailbone/templates/products/view.mako index 52dc3476..4ed34917 100644 --- a/tailbone/templates/products/view.mako +++ b/tailbone/templates/products/view.mako @@ -59,6 +59,7 @@ ${render_field_readonly(form.fieldset.special_order)} ${render_field_readonly(form.fieldset.organic)} ${render_field_readonly(form.fieldset.not_for_sale)} + ${render_field_readonly(form.fieldset.discontinued)} ${render_field_readonly(form.fieldset.deleted)} diff --git a/tailbone/views/products.py b/tailbone/views/products.py index 59d8f916..9d74b899 100644 --- a/tailbone/views/products.py +++ b/tailbone/views/products.py @@ -82,7 +82,7 @@ class DescriptionFieldRenderer(fa.TextFieldRenderer): description = self.raw_value if description is None: return '' - if kwargs.get('link'): + if kwargs.get('link') and description: product = self.field.parent.model description = tags.link_to(description, kwargs['link'](product)) return description @@ -314,6 +314,7 @@ class ProductsView(MasterView): fs.not_for_sale, fs.ingredients, fs.notes, + fs.discontinued, fs.deleted, fs.last_sold, ])