Add render_person() convenience method for MasterView

This commit is contained in:
Lance Edgar 2019-04-25 14:46:11 -05:00
parent 25c8edd81c
commit cb67a23d0a

View file

@ -850,6 +850,14 @@ class MasterView(View):
url = self.request.route_url('reportcodes.view', uuid=report.uuid) url = self.request.route_url('reportcodes.view', uuid=report.uuid)
return tags.link_to(text, url) return tags.link_to(text, url)
def render_person(self, obj, field):
person = getattr(obj, field)
if not person:
return ""
text = six.text_type(person)
url = self.request.route_url('people.view', uuid=person.uuid)
return tags.link_to(text, url)
def before_create_flush(self, obj, form): def before_create_flush(self, obj, form):
pass pass