Add hyperlink to EmployeeFieldRenderer
This commit is contained in:
parent
11f91d42d2
commit
8b02fd3d38
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2015 Lance Edgar
|
# Copyright © 2010-2017 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -24,9 +24,11 @@
|
||||||
Employee Field Renderers
|
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):
|
class EmployeeFieldRenderer(AutocompleteFieldRenderer):
|
||||||
|
@ -39,4 +41,7 @@ class EmployeeFieldRenderer(AutocompleteFieldRenderer):
|
||||||
employee = self.raw_value
|
employee = self.raw_value
|
||||||
if not employee:
|
if not employee:
|
||||||
return ''
|
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
|
||||||
|
|
Loading…
Reference in a new issue