Tuesday, January 26, 2016

Re: django pagination

i foolow the steps but i have again error my new view :

def index(request):
try:
page = request.GET.get('page', 1),
except PageNotAnInteger:
page = 1,
objects = ['john', 'edward', 'josh', 'frank']
p = Paginator(objects,request=request)
people = p.page(page)
return render_to_response("blog/movies_list.html", {
'ranking' : Movies.objects.all().order_by('-rating')[:3],
'likes': Movies.objects.all().order_by('-like')[:3],
'categories': Category.objects.all(),
'people':people,
'posts': Movies.objects.filter(publisheddate__lte=timezone.now()).order_by('-publisheddate')
})

first i dont understand how is the objects
the show error in the line :p = Paginator(objects,request=request) any idea ?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b914061b-bf4a-4a36-a3df-ca97a5ed1473%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment