示例#1
0
def tag_blogs(request, tag_name):
    try:
        tag = Tag.objects.get(tag_name=tag_name)
        blogs = tag.blog_set.all()
        pages, blogs = getPages(request, blogs)
        return blog_list_show(request, pages, blogs)
    except Exception:
        raise Http404
示例#2
0
def tag_articles(request, tag_name):
    try:
        tag = Tag.objects.get(tag_name=tag_name)
        articles = tag.article_set.all()
        pages, articles = getPages(request, articles)
        return article_list_show(request, pages, articles)
    except Exception:
        raise Http404
示例#3
0
def search_blog(request):
    try:
        wd = request.GET['wd']
        if not wd:
            return HttpResponseRedirect(reverse('blog:blog_index'))

        blogs = Blog.objects.filter(caption__icontains=wd)
        pages, blogs = getPages(request, blogs)
        return blog_list_show(request, pages, blogs)
    except Exception:
        raise Http404
示例#4
0
def search_article(request):
    try:
        wd = request.GET['wd']
        if not wd:
            return HttpResponseRedirect(reverse('sonata:article_index'))

        articles = Article.objects.filter(caption__icontains=wd)
        pages, articles = getPages(request, articles)
        return article_list_show(request, pages, articles)
    except Exception:
        raise Http404
示例#5
0
def blog_index(request):
    """ 显示博客的列表 """
    blogs = Blog.objects.all()
    pages, blogs = getPages(request, blogs)
    return blog_list_show(request, pages, blogs)
示例#6
0
def recommend_blogs(request):
    blogs = Blog.objects.filter(recommend=True)
    pages, blogs = getPages(request, blogs)
    return blog_list_show(request, pages, blogs)
示例#7
0
def article_index(request):
    """ 显示文章的列表 """
    articles = Article.objects.all()
    pages, articles = getPages(request, articles)
    return article_list_show(request, pages, articles)
示例#8
0
def recommend_articles(request):
    articles = Article.objects.filter(recommend=True)
    pages, articles = getPages(request, articles)
    return article_list_show(request, pages, articles)