Skip to content

Commit

Permalink
Commit to DB earlier (#897)
Browse files Browse the repository at this point in the history
  • Loading branch information
berggren authored May 28, 2019
1 parent 643e2f1 commit e7659f1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions timesketch/views/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ def home():
description=form.description.data,
user=current_user)
sketch.status.append(sketch.Status(user=None, status='new'))
db_session.add(sketch)
db_session.commit()

# Give the requesting user permissions on the new sketch.
sketch.grant_permission(permission='read', user=current_user)
sketch.grant_permission(permission='write', user=current_user)
sketch.grant_permission(permission='delete', user=current_user)
db_session.add(sketch)
db_session.commit()
return redirect(url_for('sketch_views.overview', sketch_id=sketch.id))

return render_template(
Expand Down

0 comments on commit e7659f1

Please sign in to comment.