Esempio n. 1
0
def list():
    posts = Post.query.order_by(Post.created.desc())
    posts = posts.paginate(get_page(), per_page=5)
    fp['posts'] = posts

    fp['breadcrumb'] = [{'v': 'Articles'}]

    fp['title'] = 'Posts'

    return render_template(theme['active'] + '/' + 'posts.html', fp=fp)
Esempio n. 2
0
def list():
  posts = Post.query.order_by(Post.created.desc())
  posts = posts.paginate(get_page(), per_page=5)
  fp['posts'] = posts

  fp['breadcrumb'] = [
    {'v' : 'Articles'}
  ]

  fp['title'] = 'Posts'

  return render_template(
    theme['active']+'/'+'posts.html',
    fp=fp
  )
Esempio n. 3
0
def tag(slug):
    tag = Tag.query.filter_by(link=slug).first()
    if (tag):
        posts = Post.query.filter(Post.tags.contains(tag)).order_by(
            Post.created.desc())
        posts = posts.paginate(get_page(), per_page=5)
        fp['tag'] = tag
        fp['posts'] = posts

        fp['breadcrumb'] = [{'a': '/posts/t/', 'v': 'Tags'}, {'v': tag.name}]

        fp['title'] = tag.name

        return render_template(theme['active'] + '/' + 'tag.html', fp=fp)
    else:
        abort(404)
Esempio n. 4
0
def category(slug):
  category = Category.query.filter_by(link=slug).first()
  if (category):
    posts = Post.query.filter_by(id_category=category.id).order_by(Post.created.desc())
    posts = posts.paginate(get_page(), per_page=5)
    fp['category'] = category
    fp['posts']    = posts

    fp['breadcrumb'] = [
      {'a' : '/posts/c/', 'v' : 'Categories'},
      {'v' : category.title}
    ]

    fp['title'] = category.title

    return render_template(
      theme['active']+'/'+'category.html',
      fp=fp
    )
  else:
    abort(404)
Esempio n. 5
0
def tag(slug):
  tag = Tag.query.filter_by(link=slug).first()
  if (tag):
    posts = Post.query.filter(Post.tags.contains(tag)).order_by(Post.created.desc())
    posts = posts.paginate(get_page(), per_page=5)
    fp['tag'] = tag
    fp['posts'] = posts

    fp['breadcrumb'] = [
      {'a' : '/posts/t/', 'v' : 'Tags'},
      {'v' : tag.name}
    ]

    fp['title'] = tag.name

    return render_template(
      theme['active']+'/'+'tag.html',
      fp=fp
    )
  else:
    abort(404)
Esempio n. 6
0
def category(slug):
    category = Category.query.filter_by(link=slug).first()
    if (category):
        posts = Post.query.filter_by(id_category=category.id).order_by(
            Post.created.desc())
        posts = posts.paginate(get_page(), per_page=5)
        fp['category'] = category
        fp['posts'] = posts

        fp['breadcrumb'] = [{
            'a': '/posts/c/',
            'v': 'Categories'
        }, {
            'v': category.title
        }]

        fp['title'] = category.title

        return render_template(theme['active'] + '/' + 'category.html', fp=fp)
    else:
        abort(404)