Introducing embed_project

By specifying the 'embed_project' argument, the node's Project will be fetched and embedded in the document. This is useful in specific cases, where a project property needs to be accessed when rendering the view_embed template.
This commit is contained in:
Francesco Siddi 2017-09-30 22:13:10 +02:00
parent 2d01cd8761
commit e9233ff7c0

View File

@ -201,6 +201,9 @@ def view(node_id):
if node.file and node.file_variations:
node.file.length = max(var.length for var in node.file_variations)
if request.args.get('embed_project') == '1':
node.project = Project.find(node.project, api=api)
if request.args.get('format') == 'json':
node = node.to_dict()
node['url_edit'] = url_for('nodes.edit', node_id=node['_id'])