I need to make ajax pagination in my project and not allowed to use side modules like dajax or endless-pagination.
Code in my views.py is following
Need to load new pages with AJAX
How it should be done?
-- Code in my views.py is following
def listing(request):
news_list = NewPost.objects.all()
paginator = Paginator(news_list, 2)
page = request.GET.get('page')
try:
news = paginator.page(page)
except PageNotAnInteger:
news = paginator.page(1)
except EmptyPage:
news = paginator.page(paginator.num_pages)
return render_to_response('list.html', {"news": news})How it should be done?
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/059aff43-9578-4265-8cd0-21e900b83d97%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment