Ejemplo n.º 1
0
 def create_post_comment(file, comment_content):
     post = Post(
         author=request.user,
         photo=file,
     )
     post.save()
     if comment_content != '':
         post.add_comment(
             user=request.user,
             content=comment_content,
         )
Ejemplo n.º 2
0
 def create_post_comment_from_data(file, comment_content):
     post = Post(author=user, photo=file)
     post.save()
     if comment_content.strip() != '':
         post.add_comment(user, comment_content)