Make product field renderer allow override of link text rendering
This commit is contained in:
parent
d51b9d2ad7
commit
bf09071e1d
|
@ -58,9 +58,14 @@ class ProductFieldRenderer(AutocompleteFieldRenderer):
|
||||||
def render_readonly(self, **kwargs):
|
def render_readonly(self, **kwargs):
|
||||||
product = self.raw_value
|
product = self.raw_value
|
||||||
if not product:
|
if not product:
|
||||||
return ''
|
return ""
|
||||||
|
render = kwargs.get('render_product', self.render_product)
|
||||||
|
text = render(product)
|
||||||
if kwargs.get('hyperlink', True):
|
if kwargs.get('hyperlink', True):
|
||||||
return tags.link_to(product, self.request.route_url('products.view', uuid=product.uuid))
|
return tags.link_to(text, self.request.route_url('products.view', uuid=product.uuid))
|
||||||
|
return text
|
||||||
|
|
||||||
|
def render_product(self, product):
|
||||||
return six.text_type(product)
|
return six.text_type(product)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue