示例#1
0
def base_context():
    context = Context(
        {
            "current_user": current_user(),
            "admin": admin(),
            "login_url": users.create_login_url("/blogs"),
            "logout_url": users.create_logout_url("/blogs"),
            "recent_comments": Comment.all().order("-date").fetch(5),
            "categories": Category.all(),
            "blogs_count": Blog.all().count(),
            "archives": Archive.all().order("-year").order("-month"),
            "friendlyURLs": FriendlyURL.all(),
        }
    )
    configuration = Configuration.all().fetch(1)
    if configuration:
        context.configuration = configuration[0]
    else:
        context.configuration = False
    return context
示例#2
0
def base_context():
    context = Context({
        'current_user':current_user(),
        'admin':admin(),
        'login_url':users.create_login_url('/blogs'),
        'logout_url':users.create_logout_url('/blogs'),
        'recent_comments':Comment.all().order('-date').fetch(5),
        'categories':Category.all(),
        'blogs_count':Blog.all().count(),
        'archives':Archive.all().order('-year').order('-month'),
        'friendlyURLs':FriendlyURL.all()
    })
    configuration=Configuration.all().fetch(1)
    if configuration:
        context.configuration=configuration[0]
    return context