From 24a2c158509dc9a0744f9c27fa3f084543b68671 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 3 Jul 2017 15:52:41 -0500 Subject: [PATCH] Make hyperlink optional for employee field renderer --- tailbone/forms/renderers/employees.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tailbone/forms/renderers/employees.py b/tailbone/forms/renderers/employees.py index ead3c93a..b8c09d45 100644 --- a/tailbone/forms/renderers/employees.py +++ b/tailbone/forms/renderers/employees.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8; -*- ################################################################################ # # Rattail -- Retail Software Framework @@ -26,6 +26,7 @@ Employee Field Renderers from __future__ import unicode_literals, absolute_import +import six from webhelpers.html import tags from tailbone.forms.renderers import AutocompleteFieldRenderer @@ -41,7 +42,8 @@ class EmployeeFieldRenderer(AutocompleteFieldRenderer): employee = self.raw_value if not employee: return '' - title = unicode(employee.person) - if self.request.has_perm('employees.view'): + render_name = kwargs.get('render_name', six.text_type) + title = render_name(employee) + if kwargs.get('hyperlink') and self.request.has_perm('employees.view'): return tags.link_to(title, self.request.route_url('employees.view', uuid=employee.uuid)) return title