From 3cd5fa7f4a428426f90ad0644da0f47bd7d9b66c Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 23 Oct 2020 22:08:43 -0500 Subject: [PATCH] Misc. tweaks to vendor catalog views for sake of titeship --- tailbone/templates/batch/vendorcatalog/index.mako | 11 +++++++++++ tailbone/views/batch/vendorcatalog.py | 8 -------- tailbone/views/master.py | 5 ++++- 3 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 tailbone/templates/batch/vendorcatalog/index.mako diff --git a/tailbone/templates/batch/vendorcatalog/index.mako b/tailbone/templates/batch/vendorcatalog/index.mako new file mode 100644 index 00000000..70412b39 --- /dev/null +++ b/tailbone/templates/batch/vendorcatalog/index.mako @@ -0,0 +1,11 @@ +## -*- coding: utf-8; -*- +<%inherit file="/batch/index.mako" /> + +<%def name="context_menu_items()"> + ${parent.context_menu_items()} + % if request.has_perm('vendors.list'): +
  • ${h.link_to("View Vendors", url('vendors'))}
  • + % endif + + +${parent.body()} diff --git a/tailbone/views/batch/vendorcatalog.py b/tailbone/views/batch/vendorcatalog.py index f4692e5d..945b3758 100644 --- a/tailbone/views/batch/vendorcatalog.py +++ b/tailbone/views/batch/vendorcatalog.py @@ -186,14 +186,6 @@ class VendorCatalogsView(FileBatchMasterView): if not self.creating: f.set_readonly('effective') - def render_vendor(self, batch, field): - vendor = batch.vendor - if not vendor: - return "" - text = "({}) {}".format(vendor.id, vendor.name) - url = self.request.route_url('vendors.view', uuid=vendor.uuid) - return tags.link_to(text, url) - def get_batch_kwargs(self, batch): kwargs = super(VendorCatalogsView, self).get_batch_kwargs(batch) kwargs['parser_key'] = batch.parser_key diff --git a/tailbone/views/master.py b/tailbone/views/master.py index d48618e8..8c0ee61d 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -928,7 +928,10 @@ class MasterView(View): vendor = getattr(obj, field) if not vendor: return "" - text = "({}) {}".format(vendor.id, vendor.name) + if vendor.id: + text = "({}) {}".format(vendor.id, vendor.name) + else: + text = six.text_type(vendor) url = self.request.route_url('vendors.view', uuid=vendor.uuid) return tags.link_to(text, url)