Make hyperlink optional for employee field renderer
This commit is contained in:
parent
e2b22221c4
commit
24a2c15850
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue