|
|
@@ -66,13 +66,15 @@ def edit_tool(tool_id): |
|
|
|
db.session.commit() |
|
|
|
if linked_resource: |
|
|
|
for linked_resource in request.form.getlist('linked_resources'): |
|
|
|
first_resource_id = tool_id |
|
|
|
second_resource_id = linked_resource |
|
|
|
new_relationship = Relationship(first_resource_id=first_resource_id, second_resource_id=second_resource_id) |
|
|
|
link = Resource.query.get(linked_resource) |
|
|
|
if link not in links: |
|
|
|
first_resource_id = tool_id |
|
|
|
second_resource_id = linked_resource |
|
|
|
new_relationship = Relationship(first_resource_id=first_resource_id, second_resource_id=second_resource_id) |
|
|
|
|
|
|
|
# add the new relationship to the database |
|
|
|
db.session.add(new_relationship) |
|
|
|
db.session.commit() |
|
|
|
# add the new relationship to the database |
|
|
|
db.session.add(new_relationship) |
|
|
|
db.session.commit() |
|
|
|
return redirect(url_for('tool.get_tools')) |
|
|
|
|
|
|
|
return render_template('edit.html', resource=tool, resource_dropdown=resource_dropdown, links=links) |