Beispiel #1
0
 def by_id(cls, post_id):
     return DBSession.query(Post).filter(cls.id == post_id).first()
Beispiel #2
0
 def get_recent(cls):
     return DBSession.query(Post).order_by(sa.desc(cls.created))[:5]
Beispiel #3
0
 def get_posts_by_tag(cls, tag):
     # return DBSession.query(Post).join(Post.tags).filter(sa.func.lower(Tag.name) == tag)
     return DBSession.query(Post).join(Post.tags).filter(Tag.slug == tag)
Beispiel #4
0
 def all(cls):
     return DBSession.query(Post).order_by(sa.desc(cls.created))
Beispiel #5
0
 def get_all(cls):
     return DBSession.query(Tag).order_by(sa.asc(cls.name))
Beispiel #6
0
 def get_by_name(cls, tag):
     return DBSession.query(Tag).filter(cls.name == tag).first()
Beispiel #7
0
 def get_posts_by_category_slug(cls, category_slug):
     return DBSession.query(Post).join(Category).filter(Category.slug == category_slug)
Beispiel #8
0
 def get_posts_by_category(cls, category):
     return DBSession.query(Post).join(Category).filter(sa.func.lower(Category.name) == category)
Beispiel #9
0
 def by_id(cls, category_id):
     return DBSession.query(Category).filter(cls.id == category_id).first()
Beispiel #10
0
 def by_name(cls, name):
     return DBSession.query(User).filter(User.name == name).first()
Beispiel #11
0
 def all(cls):
     return DBSession.query(User).order_by(sa.desc(cls.name))