Example #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})
Example #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})
Example #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')
Example #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
    })
Example #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')
Example #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})
Example #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})
Example #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})