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})
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})
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')
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 })
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')
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})
def index(request): page = request.GET.get('page',1) posts = Entry.objects.get_posts() return render(request, 'index.html', {'entries':posts, 'page':page})
def index(request): page = request.GET.get('page', 1) posts = Entry.objects.get_posts() return render(request, 'index.html', {'entries': posts, 'page': page})