Exemplo n.º 1
0
def index(request):
    userInfos = common.Users(request, -1)

    viewTopArticleList = common.viewTopArticleList()
    commentTopArticleList = common.commentTopArticleList()
    newTopArticleList = common.newTopArticleList()
    newTopUserList = common.newTopUserList()

    categoryList = common.categoryList()

    articleList = Article.objects.order_by("-createTime").all()

    return utility.my_render_to_response(request, "index.html", locals())
Exemplo n.º 2
0
def tags(request, uid, cid):
    uid = int(uid)
    userInfos = common.Users(request, uid)
    templateName = templateName = userInfos[5].blog_template

    viewTopArticleList = common.viewTopArticleList(uid)
    commentTopArticleList = common.commentTopArticleList(uid)
    newTopArticleList = common.newTopArticleList(uid)
    newTopUserList = common.newTopUserList()

    categoryList = common.categoryList(uid)

    articleList = Article.objects.order_by("-createTime").filter(
        user_id=uid).filter(category_id=cid).filter(status=1)

    return utility.my_render_to_response(request, templateName + "/home.html",
                                         locals())
Exemplo n.º 3
0
def show(request, uid=-1, aid=-1, *arg, **kwarg):
    uid = int(uid)
    userInfos = common.Users(request, uid)

    templateName = templateName = userInfos[5].blog_template

    viewTopArticleList = common.viewTopArticleList(uid)
    commentTopArticleList = common.commentTopArticleList(uid)
    newTopArticleList = common.newTopArticleList(uid)
    newTopUserList = common.newTopUserList()

    categoryList = common.categoryList(uid)

    articleInfo = Article.objects.get(id=aid)
    title = articleInfo.title
    content = articleInfo.content
    articleInfo.views += 1
    if not articleInfo.createTime:
        articleInfo.createTime = datetime.datetime.now()

    articleInfo.save()

    return utility.my_render_to_response(request, templateName + "/show.html",
                                         locals())