def get_context_data(self): paginator = Paginator(all_pending_comments(), 100) try: p = paginator.page(self.request.GET.get('page', '1')) except PageNotAnInteger: p = paginator.page('1') return dict(comments=p.object_list, paginator=p)
def post(self, request): for comment in all_pending_comments(): comment.delete() return HttpResponseRedirect("/pending_comments/")