Beispiel #1
0
async def api_create_comments(request, *, blog_id, content):
    if not request.__user__:
        raise Exception('user not found')
    if not blog_id:
        raise Exception('blog id not found')
    comment = Comment(blog_id=blog_id, user_id=request.__user__.id, user_name=request.__user__.name, user_image='blank:about', content=content)
    await comment.save()
    comment.html_content = markdown2.markdown(comment.content, safe_mode=True)
    return comment