diff --git a/tailbone/views/people.py b/tailbone/views/people.py index 5660c5ca..c8dc73b6 100644 --- a/tailbone/views/people.py +++ b/tailbone/views/people.py @@ -59,6 +59,20 @@ class CustomersFieldRenderer(fa.FieldRenderer): return HTML.tag('ul', c=items) +class UsersFieldRenderer(fa.FieldRenderer): + + def render_readonly(self, **kwargs): + users = self.raw_value + if not users: + return "" + items = [] + for user in users: + text = user.username + url = self.request.route_url('users.view', uuid=user.uuid) + items.append(HTML.tag('li', c=tags.link_to(text, url))) + return HTML.tag('ul', c=items) + + class PeopleView(MasterView): """ Master view for the Person class. @@ -141,6 +155,7 @@ class PeopleView(MasterView): fs.address.set(label="Mailing Address", readonly=True) fs.employee.set(renderer=forms.renderers.EmployeeFieldRenderer, attrs={'hyperlink': True}, readonly=True) fs._customers.set(renderer=CustomersFieldRenderer, readonly=True) + fs.users.set(renderer=UsersFieldRenderer, readonly=True) def configure_fieldset(self, fs): fs.configure( @@ -154,6 +169,7 @@ class PeopleView(MasterView): fs.address, fs.employee, fs._customers, + fs.users, ]) def get_version_child_classes(self):