Add "generic" render_id_str() method to MasterView

not sure how useful, but maybe
This commit is contained in:
Lance Edgar 2020-03-23 21:25:43 -05:00
parent eaeda6ca36
commit 13802c49a8
2 changed files with 7 additions and 4 deletions

View file

@ -228,7 +228,7 @@ class BatchMasterView(MasterView):
g.set_enum('status_code', self.model_class.STATUS)
g.set_renderer('id', self.render_batch_id)
g.set_renderer('id', self.render_id_str)
g.set_link('id')
g.set_link('description')
@ -238,9 +238,6 @@ class BatchMasterView(MasterView):
g.set_label('rowcount', "Rows")
g.set_label('status_code', "Status")
def render_batch_id(self, batch, column):
return batch.id_str
def template_kwargs_index(self, **kwargs):
route_prefix = self.get_route_prefix()
if self.results_executable:

View file

@ -848,6 +848,12 @@ class MasterView(View):
'importer_host_title': importer_host_title,
})
def render_id_str(self, obj, field):
"""
Render the ``id_str`` attribute value for the given object.
"""
return obj.id_str
def render_default_phone(self, obj, field):
"""
Render the "default" (first) phone number for the given contact.