Пример #1
1
 def hot_posts(cls, count=8, order="view_count desc"):
     return [cls(post) for post in DBPost.hot_posts(count, order)]
Пример #2
0
 def create_post(cls, author, category, **settings):
     dbpost = DBPost.create(author_id=author.db_object.id, category_id=category.db_object.id)
     dbpost.save()
     _ = dbpost.stats  # init stats
     author.stats.increase("post_count")
     category.stats.increase("post_count")
     post = cls(dbpost)
     post.update(**settings)
     return post
Пример #3
0
 def create_post(cls, author, category, **settings):
     dbpost = DBPost.create(author_id=author.db_object.id, category_id=category.db_object.id)
     dbpost.save()
     _ = dbpost.stats  # init stats
     author.stats.increase("post_count")
     category.stats.increase("post_count")
     post = cls(dbpost)
     post.update(**settings)
     return post
Пример #4
0
 def latest_posts(cls, count=8, order="updated_date desc"):
     return [cls(post) for post in DBPost.latest_posts(count, order)]
Пример #5
0
 def hot_posts(cls, count=8, order="view_count desc"):
     return [cls(post) for post in DBPost.hot_posts(count, order)]
Пример #6
0
 def get_by_id(cls, id):
     dbpost = id and DBPost.get_by_id(id)
     return dbpost and cls(dbpost)
Пример #7
0
 def latest_posts(cls, count=8, order="updated_date desc"):
     return [cls(post) for post in DBPost.latest_posts(count, order)]
Пример #8
0
 def get_by_id(cls, id):
     dbpost = DBPost.get_by_id(id)
     return dbpost and cls(dbpost)
Пример #9
0
 def latest_posts(cls, count=8, order="updated_date desc"):
     return DBPost.latest_posts(count, order)
Пример #10
0
 def hot_posts(cls, count=8, order="view_count desc"):
     return DBPost.hot_posts(count, order)
Пример #11
0
 def latest_posts(cls, count=8, order="updated_date desc"):
     return DBPost.latest_posts(count, order)
Пример #12
0
 def hot_posts(cls, count=8, order="view_count desc"):
     return DBPost.hot_posts(count, order)