def view(request): users = User.objects.order_by('-is_staff', 'date_joined') page = AutoPaginator(request, users, 20).current_page() return render(request, 'admin/users/view.html', { 'page': page, })
def view(request): jobs = request.user.jobs.all() page = AutoPaginator(request, jobs, 20).current_page() return render(request, 'dashboard/view.html', { 'page': page, })
def view(request): form = FilterForm(request.GET) if not form.is_valid(): return HttpResponseBadRequest(form.errors.as_json()) qs = User.objects.all() page = AutoPaginator(request, form.apply_filter(qs), 20).current_page() return render(request, 'admin/users/view.html', { 'form': form, 'page': page, })
def view(request, job_type=None): form = FilterForm(job_type, request.GET) # Redirect if we need to target = form.get_redirect() if target: return redirect(target) qs = form.get_queryset() page = AutoPaginator(request, qs, 20).current_page() return render(request, 'jobs/view.html', { 'page': page, 'form': form, })
def view(request, state_slug=''): try: state = StateEnum[state_slug.upper()] except KeyError: return redirect( 'admin:view', StateEnum.WAITING_FOR_APPROVAL.name.lower(), ) jobs = Job.objects.filter(state=state) page = AutoPaginator(request, jobs, 20).current_page() by_state = Job.objects.by_state() return render(request, 'admin/view.html', { 'page': page, 'state': state, 'by_state': by_state, })