From 8b02fd3d382e66db0dc6d7a264d719178ece9ec3 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 4 Feb 2017 12:32:12 -0600 Subject: [PATCH] Add hyperlink to EmployeeFieldRenderer --- tailbone/forms/renderers/employees.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tailbone/forms/renderers/employees.py b/tailbone/forms/renderers/employees.py index 0a9d7e55..ead3c93a 100644 --- a/tailbone/forms/renderers/employees.py +++ b/tailbone/forms/renderers/employees.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2015 Lance Edgar +# Copyright © 2010-2017 Lance Edgar # # This file is part of Rattail. # @@ -24,9 +24,11 @@ Employee Field Renderers """ -from __future__ import unicode_literals +from __future__ import unicode_literals, absolute_import -from .common import AutocompleteFieldRenderer +from webhelpers.html import tags + +from tailbone.forms.renderers import AutocompleteFieldRenderer class EmployeeFieldRenderer(AutocompleteFieldRenderer): @@ -39,4 +41,7 @@ class EmployeeFieldRenderer(AutocompleteFieldRenderer): employee = self.raw_value if not employee: return '' - return unicode(employee.person) + title = unicode(employee.person) + if self.request.has_perm('employees.view'): + return tags.link_to(title, self.request.route_url('employees.view', uuid=employee.uuid)) + return title