Exemplo n.º 1
0
def blog(request):
    user_id = authenticated_userid(request)
    page = int(request.params.get('page', 1))
    paginator = Post.get_paginator(request, page)
    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, 
            'tags': tags,
            }
Exemplo n.º 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,
            }