Exemple #1
0
def blog_tags(request):
    user_id = authenticated_userid(request)
    page = int(request.params.get('page', 1))
    tag = request.matchdict.get('tag', 1)
    
    paginator = Tag.get_paginator(request, page=page, tag=tag)
    recent = Post.get_recent()
    posts= Post.all()
    years = Post.get_years_desc()
    categories = Category.get_all()
    tags = Tag.get_all()

    return {'paginator': paginator,
            'user_id': user_id,
            'recent': recent,
            'posts': posts,
            'years': years,
            'categories': categories,
            't': tag,
            'tags': tags,
            }
Exemple #2
0
def blog_details(request):
    user_id = authenticated_userid(request)
    post_id = int(request.matchdict.get('id', 1))
    blog_post = Post.by_id(post_id)
    if not blog_post:
        return HTTPNotFound()
    recent = Post.get_recent()
    posts= Post.all()
    years = Post.get_years_desc()
    categories = Category.get_all()
    tags = Tag.get_all()
    
    return {'blog_post': blog_post,
            'user_id': user_id,
            'recent': recent,
            'posts': posts,
            'post': blog_post,
            'years': years,
            'categories': categories,
            'tags': tags,
            }