@main.route('/post/<int:id>', methods=['GET', 'POST'])
def post(id):
    post = Post.query.get_or_404(id)

    # Allowing comments
    form = CommentForm()
    if form.validate_on_submit():
        comment = Comment(body=form.body.data,
                          post=post,
                          author=current_user._get_current_object())
        db.session.add(comment)
        flash('Comment has been published.')
        return redirect(url_for('.post', id=post.id, page=-1))
    page = request.args.get('page', 1, type=int)
    if page == -1:
        page = (1 - post.comments.count()) / \
            current_app.config['ANTISOCIAL_COMMENTS_PER_PAGE'] + 1
    pagination = post.comments.order_by(Comment.timestamp.asc()).paginate(
        page, per_page=current_app.config['ANTISOCIAL_COMMENTS_PER_PAGE'],
        error_out=False)
    comments = pagination.items


    # we send a list so that _post.html template can be used
    return render_template('post.html', posts=[post], form=form,
                           comments=comments, pagination=pagination)


# edit posts
dataset/ETHPy150Open bt3gl/The-Anti-Social-Network/app/main/views.py/post/swapped operands of `-`