Export Person.users
relationship (readonly)
This commit is contained in:
parent
a51d4e54db
commit
2bd2839107
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue