From df8778f85d33f9f1176e97c1d11842cf14757b64 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 5 Nov 2021 15:11:30 -0500 Subject: [PATCH] Add `render_brand()` method for MasterView --- tailbone/views/master.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tailbone/views/master.py b/tailbone/views/master.py index 1ab87bb6..1eb7686a 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -791,6 +791,14 @@ class MasterView(View): url = self.request.route_url('subdepartments.view', uuid=subdepartment.uuid) return tags.link_to(text, url) + def render_brand(self, obj, field): + brand = getattr(obj, field) + if not brand: + return + text = brand.name + url = self.request.route_url('brands.view', uuid=brand.uuid) + return tags.link_to(text, url) + def render_category(self, obj, field): category = getattr(obj, field) if not category: