Add a generic "user" field renderer to master view
and use it for PersonNote view
This commit is contained in:
parent
e097f526bb
commit
6749604210
|
@ -881,6 +881,14 @@ class MasterView(View):
|
||||||
url = self.request.route_url('people.view', uuid=person.uuid)
|
url = self.request.route_url('people.view', uuid=person.uuid)
|
||||||
return tags.link_to(text, url)
|
return tags.link_to(text, url)
|
||||||
|
|
||||||
|
def render_user(self, obj, field):
|
||||||
|
user = getattr(obj, field)
|
||||||
|
if not user:
|
||||||
|
return ""
|
||||||
|
text = six.text_type(user)
|
||||||
|
url = self.request.route_url('users.view', uuid=user.uuid)
|
||||||
|
return tags.link_to(text, url)
|
||||||
|
|
||||||
def before_create_flush(self, obj, form):
|
def before_create_flush(self, obj, form):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -424,6 +424,7 @@ class PersonNoteView(MasterView):
|
||||||
super(PersonNoteView, self).configure_form(f)
|
super(PersonNoteView, self).configure_form(f)
|
||||||
|
|
||||||
f.set_renderer('person', self.render_person)
|
f.set_renderer('person', self.render_person)
|
||||||
|
f.set_renderer('created_by', self.render_user)
|
||||||
|
|
||||||
|
|
||||||
@colander.deferred
|
@colander.deferred
|
||||||
|
|
Loading…
Reference in a new issue