示例#1
0
def single (request,id=None):
    try:
        entry = Entry.objects.get(id=id)
        entry.update_readtimes()
    except:
        return render_to_response('404.html')
    return render(request,"single.html",{'entry':entry})
示例#2
0
def single(request, id=None):
    try:
        entry = Entry.objects.get(id=id)
        entry.update_readtimes()
    except:
        return render_to_response('404.html')
    return render(request, "single.html", {'entry': entry})
示例#3
0
def category(request,name):
    try:
        if name:
            cat = Category.objects.get(slug=name)
            page = request.GET.get('page',1)
            posts = Entry.objects.get_posts().filter(category=cat)
            return render(request,'category.html',{'entries':posts,'category':cat,'page':page})
    except:
        return HttpResponseRedirect('404.html')
示例#4
0
def archives(request, year, month):
    page = request.GET.get('page', 1)
    posts = Entry.objects.get_post_by_date(year, month)
    return render(request, 'archives.html', {
        'entries': posts,
        'page': page,
        'year': year,
        'month': month
    })
示例#5
0
def category(request, name):
    try:
        if name:
            cat = Category.objects.get(slug=name)
            page = request.GET.get('page', 1)
            posts = Entry.objects.get_posts().filter(category=cat)
            return render(request, 'category.html', {
                'entries': posts,
                'category': cat,
                'page': page
            })
    except:
        return HttpResponseRedirect('404.html')
示例#6
0
def archives(request,year,month):
    page = request.GET.get('page',1)
    posts = Entry.objects.get_post_by_date(year,month)
    return render(request,'archives.html',{'entries':posts,'page':page,'year':year,'month':month})
示例#7
0
def index(request):
    page = request.GET.get('page',1)
    posts = Entry.objects.get_posts()
    return render(request, 'index.html', {'entries':posts, 'page':page})
示例#8
0
def index(request):
    page = request.GET.get('page', 1)
    posts = Entry.objects.get_posts()
    return render(request, 'index.html', {'entries': posts, 'page': page})