def item_links(item_id): """Get links to specified item. :resheader Content-Type: *application/json* """ item = Item.query.filter_by(id=item_id).options(db.joinedload('items_linked').joinedload('item')).first() if item is None: abort(404) links = [] for item_link in item.items_linked: links.append(dict( item_id=item_link.item_id, path=item_link.type, value=item_link.value, )) return jsonify(links=links)
def item_links(item_id): item = Item.query.filter_by(id=item_id).options(db.joinedload('items_linked').joinedload('item')).first() if item is None: abort(404) return render_template('item_links.html', item=item)