本文整理汇总了Python中app.models.Comment.creation_date方法的典型用法代码示例。如果您正苦于以下问题:Python Comment.creation_date方法的具体用法?Python Comment.creation_date怎么用?Python Comment.creation_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.models.Comment
的用法示例。
在下文中一共展示了Comment.creation_date方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Post
# 需要导入模块: from app.models import Comment [as 别名]
# 或者: from app.models.Comment import creation_date [as 别名]
print post_user
db_post = Post(description=post["description"], creation_date=datetime.datetime.now(), user=post_user, picture=None)
picture_path = "post_pictures/%s" % path_leaf(post["picture"])
post_picture = open("instagram/media/" + picture_path, "r")
db_post.picture.save(picture_path, File(post_picture))
db_post.save()
likes = post["likes"]
for like in likes:
db_like = Like()
db_like.user = InstagramUser.objects.filter(username=like)[0]
db_like.post = db_post
db_like.save()
comments = post["comments"]
for comment in comments:
comment_user = InstagramUser.objects.filter(username=comment["user"])[0]
db_comment = Comment()
db_comment.comment = comment["comment"]
db_comment.creation_date = datetime.datetime.now()
db_comment.user = comment_user
db_comment.post = db_post
db_comment.save()
posts_file.close()