Tweak how customer/person relationships are displayed

expose just a little more to make it easier to track down a data issue i had
This commit is contained in:
Lance Edgar 2017-07-03 16:58:30 -05:00
parent 24a2c15850
commit 4aa91414a5
4 changed files with 32 additions and 6 deletions

View file

@ -27,7 +27,8 @@ People Field Renderers
from __future__ import unicode_literals, absolute_import
import six
from webhelpers.html import tags
import formalchemy as fa
from webhelpers.html import tags, HTML
from tailbone.forms.renderers.common import AutocompleteFieldRenderer
@ -45,6 +46,23 @@ class PersonFieldRenderer(AutocompleteFieldRenderer):
return tags.link_to(person, self.request.route_url('people.view', uuid=person.uuid))
class PeopleFieldRenderer(fa.FieldRenderer):
"""
Renderer for "people" list relationship
"""
def render_readonly(self, **kwargs):
html = ''
people = self.raw_value
if not people:
return html
for person in people:
link = tags.link_to(person, self.request.route_url('people.view', uuid=person.uuid))
html += HTML.tag('li', c=link)
html = HTML.tag('ul', c=html)
return html
class CustomerFieldRenderer(AutocompleteFieldRenderer):
"""
Renderer for :class:`rattail.db.model.Customer` instance fields.