From bc7ccb6a9fb4dab70ea526a909d7571c0d295e1d Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 15 Dec 2021 18:06:53 -0600 Subject: [PATCH] Render "pretty" UPC by default, for batch row form fields --- tailbone/views/batch/core.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tailbone/views/batch/core.py b/tailbone/views/batch/core.py index 29aa308e..985f5502 100644 --- a/tailbone/views/batch/core.py +++ b/tailbone/views/batch/core.py @@ -627,6 +627,11 @@ class BatchMasterView(MasterView): return tags.link_to(text, url) return text + def render_upc_pretty(self, row, field): + upc = getattr(row, field) + if upc: + return upc.pretty() + def render_row_status(self, row, column): code = row.status_code if code is None: @@ -662,6 +667,10 @@ class BatchMasterView(MasterView): # sequence f.set_readonly('sequence') + # upc (default rendering, just in case there is such a field + # on our row model) + f.set_renderer('upc', self.render_upc_pretty) + # status_code if self.model_row_class: f.set_enum('status_code', self.model_row_class.STATUS)