Tweak some customer view/field rendering, to allow more customization
This commit is contained in:
parent
56695d0c20
commit
eb272bf7f9
2 changed files with 11 additions and 5 deletions
|
@ -1,8 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8; -*-
|
||||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2016 Lance Edgar
|
||||
# Copyright © 2010-2017 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -26,6 +26,7 @@ People Field Renderers
|
|||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import six
|
||||
from webhelpers.html import tags
|
||||
|
||||
from tailbone.forms.renderers.common import AutocompleteFieldRenderer
|
||||
|
@ -55,4 +56,8 @@ class CustomerFieldRenderer(AutocompleteFieldRenderer):
|
|||
customer = self.raw_value
|
||||
if not customer:
|
||||
return ''
|
||||
return tags.link_to(customer, self.request.route_url('customers.view', uuid=customer.uuid))
|
||||
text = self.render_value(customer)
|
||||
return tags.link_to(text, self.request.route_url('customers.view', uuid=customer.uuid))
|
||||
|
||||
def render_value(self, customer):
|
||||
return six.text_type(customer)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue