def themeManage(request): """主题管理页面""" user = request.user theme = Theme.objects.filter(user=user.id).order_by('-add_date') paginator = JuncheePaginator(theme, 3) page = request.GET.get('page') try: contacts = paginator.page(page) except PageNotAnInteger: # If page is not an integer, deliver first page. contacts = paginator.page(1) except EmptyPage: # If page is out of range (e.g. 9999), deliver last page of results. contacts = paginator.page(paginator.num_pages) return render(request, 'manager/thememanage.html', {"contacts": contacts})
def all(request): context = {} user = request.user title = request.GET.get('title', '') themes = Theme.objects.all().order_by('-id') if title: themes = themes.filter(title__contains=title) paginator = JuncheePaginator(themes, 9) page = request.GET.get('page') try: contacts = paginator.page(page) except PageNotAnInteger: # If page is not an integer, deliver first page. contacts = paginator.page(1) except EmptyPage: # If page is out of range (e.g. 9999), deliver last page of results. contacts = paginator.page(paginator.num_pages) return render(request, 'online/alltheme.html', {"contacts": contacts})