Add render_brand() method for MasterView

This commit is contained in:
Lance Edgar 2021-11-05 15:11:30 -05:00
parent 2be1d12116
commit df8778f85d

View file

@ -791,6 +791,14 @@ class MasterView(View):
url = self.request.route_url('subdepartments.view', uuid=subdepartment.uuid) url = self.request.route_url('subdepartments.view', uuid=subdepartment.uuid)
return tags.link_to(text, url) 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): def render_category(self, obj, field):
category = getattr(obj, field) category = getattr(obj, field)
if not category: if not category: