This commit is contained in:
2017-12-08 02:31:35 +03:00
parent 18b3cf4583
commit dcbda009fa

View File

@ -2,6 +2,7 @@
from django.shortcuts import render
from .models import Post
from django.db.models import Count, Max, Min, Q
from django.http import HttpResponse
from django.utils import timezone
from django.shortcuts import render, get_object_or_404, render_to_response
from django.shortcuts import redirect
@ -30,7 +31,7 @@ def cloud():
def post_list(request, page='1', tag=None):
print('lalala')
if tag is None:
post_list = Post.objects.filter(published_date__lte=timezone.now()).order_by('-published_date')#[int(page)*5-5:int(page)*5]
else:
@ -51,8 +52,8 @@ def post_list(request, page='1', tag=None):
except EmptyPage: # If page is out of range (e.g. 9999), deliver last page of results.
posts = paginator.page(paginator.num_pages)
#print dir(posts.paginator)
return render_to_response('blog/post_list.html', {'posts': posts, 'latest': latest, 'cloud': tag_cloud, 'search_query': search_query})
# return render_to_response('blog/post_list.html', {'posts': posts, 'latest': latest, 'cloud': tag_cloud, 'search_query': search_query})
return HttpResponse('HELLO')
def post_detail(request, pk):
post = get_object_or_404(Post, pk=pk)