Python django.core.paginator.EmptyPage() Examples

The following are 30 code examples of django.core.paginator.EmptyPage(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django.core.paginator , or try the search function .
Example #1
Source File: views.py    From FIR with GNU General Public License v3.0 7 votes vote down vote up
def dashboard(request):
    bls = BusinessLine.authorization.for_user(request.user, 'incidents.view_incidents')
    bl_filter = Q(business_line__in=bls) | Q(business_line__isnull=True)
    todos = TodoItem.objects.filter(incident__isnull=False, done=False).filter(bl_filter)
    todos = todos.select_related('incident', 'category')
    todos = todos.order_by('-incident__date')

    page = request.GET.get('page', 1)
    todos_per_page = request.user.profile.incident_number
    p = Paginator(todos, todos_per_page)

    try:
        todos = p.page(page)
    except (PageNotAnInteger, EmptyPage):
        todos = p.page(1)

    return render(request, 'fir_todos/dashboard.html', {'todos': todos}) 
Example #2
Source File: views.py    From osler with GNU General Public License v3.0 7 votes vote down vote up
def clinic_date_list(request):

    qs = models.ClinicDate.objects.prefetch_related(
        'workup_set',
        'clinic_type',
        'workup_set__attending',
        'workup_set__signer',
    )

    paginator = Paginator(qs, per_page=10)
    page = request.GET.get('page')

    try:
        clinic_days = paginator.page(page)
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        clinic_days = paginator.page(1)
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of results.
        clinic_days = paginator.page(paginator.num_pages)

    return render(request, 'workup/clindate-list.html',
                  {'object_list': clinic_days,
                   'page_range': paginator.page_range}) 
Example #3
Source File: utils.py    From Servo with BSD 2-Clause "Simplified" License 7 votes vote down vote up
def paginate(queryset, page, count=10):
    """
    Shortcut for paginating a queryset
    """
    paginator = Paginator(queryset, count)

    try:
        results = paginator.page(page)
    except PageNotAnInteger:
        results = paginator.page(1)
    except EmptyPage:
        results = paginator.page(paginator.num_pages)

    return results 
Example #4
Source File: views.py    From WF-website with GNU Affero General Public License v3.0 7 votes vote down vote up
def search(request):
    search_query = request.GET.get('query', None)
    page = request.GET.get('page', 1)

    # Search
    if search_query:
        search_results = Page.objects.live().search(search_query)
        query = Query.get(search_query)

        # Record hit
        query.add_hit()
    else:
        search_results = Page.objects.none()

    # Pagination
    paginator = Paginator(search_results, 10)
    try:
        search_results = paginator.page(page)
    except PageNotAnInteger:
        search_results = paginator.page(1)
    except EmptyPage:
        search_results = paginator.page(paginator.num_pages)

    return render(request, 'search/search.html', {
        'search_query': search_query,
        'search_results': search_results,
    }) 
Example #5
Source File: models.py    From WF-website with GNU Affero General Public License v3.0 7 votes vote down vote up
def get_paginated_memorials(self, filtered_memorials, request):
        items_per_page = 10

        paginator = Paginator(filtered_memorials, items_per_page)

        memorials_page = request.GET.get("page")

        try:
            paginated_memorials = paginator.page(memorials_page)
        except PageNotAnInteger:
            # If page is not an integer, deliver first page.
            paginated_memorials = paginator.page(1)
        except EmptyPage:
            # If page is out of range (e.g. 9999), deliver last page of results.
            paginated_memorials = paginator.page(paginator.num_pages)

        return paginated_memorials 
Example #6
Source File: models.py    From WF-website with GNU Affero General Public License v3.0 7 votes vote down vote up
def get_context(self, request, *args, **kwargs):
        context = super().get_context(request)

        upcoming_events = Event.objects.all().filter(
            Q(date__gt=date.today())).order_by('date')

        # Show three archive issues per page
        paginator = Paginator(upcoming_events, 3)

        upcoming_events_page = request.GET.get("page")

        try:
            paginated_events = paginator.page(upcoming_events_page)
        except PageNotAnInteger:
            # If page is not an integer, deliver first page.
            paginated_events = paginator.page(1)
        except EmptyPage:
            # If page is out of range (e.g. 9999), deliver last page of results.
            paginated_events = paginator.page(paginator.num_pages)

        context["events"] = paginated_events

        return context 
Example #7
Source File: jobs.py    From tramcar with MIT License 7 votes vote down vote up
def jobs_mine(request):
    jobs_list = Job.objects.filter(site_id=get_current_site(request).id) \
                           .filter(user_id=request.user.id) \
                           .order_by('-created_at')
    paginator = Paginator(jobs_list, 25)
    page = request.GET.get('page')
    title = 'My Jobs'
    try:
        jobs = paginator.page(page)
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        jobs = paginator.page(1)
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of results.
        jobs = paginator.page(paginator.num_pages)
    context = {'jobs': jobs, 'title': title}
    return render(request, 'job_board/jobs_mine.html', context) 
Example #8
Source File: index.py    From BikeMaps with MIT License 7 votes vote down vote up
def index(request):
	POSTS_PER_PAGE = 5
	
	if request.user.is_superuser:
		post_list = Post.objects.all().order_by('-post_date')
	else:
		#post_list = Post.objects.filter(published=True).order_by('-post_date')
		post_list = get_Posts_By_Language_Code(request.LANGUAGE_CODE)

	paginator = Paginator(post_list, POSTS_PER_PAGE)

	page = request.GET.get('page')
	try:
		posts = paginator.page(page)
	except PageNotAnInteger:
		# If page is not an integer, deliver first page.
		posts = paginator.page(1)
	except EmptyPage:
		# If page is out of range, deliver last page of results.
		posts = paginator.page(paginator.num_pages)

	return render(request, 'blogApp/index.html', {'posts': posts}) 
Example #9
Source File: views.py    From ran-django-template with GNU General Public License v3.0 7 votes vote down vote up
def search_category(request, id):
    posts = Article.objects.filter(category_id=str(id))
    category = categories.get(id=str(id))
    paginator = Paginator(posts, settings.PAGE_NUM)  # 每页显示数量
    try:
        page = request.GET.get('page')  # 获取URL中page参数的值
        post_list = paginator.page(page)
    except PageNotAnInteger:
        post_list = paginator.page(1)
    except EmptyPage:
        post_list = paginator.page(paginator.num_pages)
    return render(request, 'category.html',
                  {'post_list': post_list,
                   'category_list': categories,
                   'category': category,
                   'months': months
                  }
    ) 
Example #10
Source File: views.py    From ran-django-template with GNU General Public License v3.0 7 votes vote down vote up
def search_tag(request, tag):
    posts = Article.objects.filter(tags__name__contains=tag)
    paginator = Paginator(posts, settings.PAGE_NUM)  # 每页显示数量
    try:
        page = request.GET.get('page')  # 获取URL中page参数的值
        post_list = paginator.page(page)
    except PageNotAnInteger:
        post_list = paginator.page(1)
    except EmptyPage:
        post_list = paginator.page(paginator.num_pages)
    return render(request, 'tag.html', {
        'post_list': post_list,
        'category_list': categories,
        'tag': tag,
        'months': months
        }
    ) 
Example #11
Source File: views.py    From monasca-ui with Apache License 2.0 7 votes vote down vote up
def get_data(self):
        page_offset = self.request.GET.get('page_offset')
        results = []
        if page_offset is None:
            page_offset = 0
        limit = utils.get_page_size(self.request)
        try:
            results = api.monitor.alarmdef_list(self.request, page_offset, limit)
            paginator = Paginator(results, limit)
            results = paginator.page(1)
        except EmptyPage:
            results = paginator.page(paginator.num_pages)
        except Exception as ex:
            LOG.exception(str(ex))
            messages.error(self.request, _("Could not retrieve alarm definitions"))

        return results 
Example #12
Source File: views.py    From dart with Apache License 2.0 7 votes vote down vote up
def get_context_data(self, **kwargs):
        logger.debug('GET: ListMissionView')
        context = super(ListMissionView, self).get_context_data(**kwargs)
        missions = Mission.objects.all()
        paginator = Paginator(missions, 10)
        page = self.request.GET.get('page')
        try:
            show_missions = paginator.page(page)
        except PageNotAnInteger:
            # If page is not an integer, deliver first page.
            show_missions = paginator.page(1)
        except EmptyPage:
            # If page is out of range (e.g. 9999), deliver last page of results.
            show_missions = paginator.page(paginator.num_pages)
        context['missions'] = show_missions
        return context 
Example #13
Source File: tools.py    From dj-diabetes with BSD 3-Clause "New" or "Revised" License 7 votes vote down vote up
def page_it(data, record_per_page, page=''):
    """
        return the data of the current page
    """
    paginator = Paginator(data, record_per_page)
    try:
        data = paginator.page(page)
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        data = paginator.page(1)
    except EmptyPage:
        # If page is out of range (e.g. 9999),
        # deliver last page of results.
        data = paginator.page(paginator.num_pages)

    return data 
Example #14
Source File: views.py    From coursys with GNU General Public License v3.0 6 votes vote down vote up
def discussion_index(request, course_slug):
    """
    Index page to view all discussion topics
    """
    course, view = _get_course_and_view(request, course_slug)
    if view is None:
        # course is an HttpResponse in this case
        return course
    topics = DiscussionTopic.objects.filter(offering=course).order_by('-pinned', '-last_activity_at')
    activity.update_last_viewed(_get_member(request.user.username, view, course_slug))
    paginator = Paginator(topics, 10)
    try:
        page = int(request.GET.get('page', '1'))
    except ValueError:
        page = 1
    try:
        topics = paginator.page(page)
    except (EmptyPage, InvalidPage):
        topics = paginator.page(paginator.num_pages)
    context = {'course': course, 'topics': topics, 'view': view, 'paginator': paginator, 'page': page}
    return render(request, 'discuss/index.html', context) 
Example #15
Source File: util.py    From open-synthesis with GNU General Public License v3.0 6 votes vote down vote up
def make_paginator(request, object_list, per_page=10, orphans=3):
    """Return a paginator for object_list from request."""
    paginator = Paginator(object_list, per_page=per_page, orphans=orphans)
    page = request.GET.get('page')
    try:
        objects = paginator.page(page)
    except PageNotAnInteger:
        # if page is not an integer, deliver first page.
        objects = paginator.page(1)
    except EmptyPage:
        # if page is out of range (e.g. 9999), deliver last page of results.
        objects = paginator.page(paginator.num_pages)
    return objects 
Example #16
Source File: views.py    From ran-django-template with GNU General Public License v3.0 6 votes vote down vote up
def archives(request, year, month):
    posts = Article.objects.filter(pub_time__year=year, pub_time__month=month).order_by('-pub_time')
    paginator = Paginator(posts, settings.PAGE_NUM)  # 每页显示数量
    try:
        page = request.GET.get('page')  # 获取URL中page参数的值
        post_list = paginator.page(page)
    except PageNotAnInteger:
        post_list = paginator.page(1)
    except EmptyPage:
        post_list = paginator.page(paginator.num_pages)
    return render(request, 'archive.html', {
        'post_list': post_list,
        'category_list': categories,
        'months': months,
        'year_month': year+'.'+month
        }
    ) 
Example #17
Source File: resource.py    From polls-api with MIT License 6 votes vote down vote up
def get_relations(self):
        paginator = self.get_paginator()

        try:
            page = paginator.page(int(self.request.GET.get('page', 1)))
        except EmptyPage:
            raise Http404()

        objects = page.object_list
        relations = {
            self.relation: self.get_resources(page)
        }

        relations['first'] = self.__class__()

        if page.has_next():
            relations['next'] = self.__class__(page.next_page_number())

        if page.has_previous():
            relations['prev'] = self.__class__(page.previous_page_number())

        if page.has_other_pages():
            relations['last'] = self.__class__(paginator.num_pages)

        return relations 
Example #18
Source File: views.py    From dart with Apache License 2.0 6 votes vote down vote up
def get_context_data(self, **kwargs):
        context = super(ListMissionTestsSupportingDataView, self).get_context_data(**kwargs)
        testdata = self.get_queryset()
        paginator = Paginator(testdata, 10)
        page = self.request.GET.get('page')
        try:
            show_data = paginator.page(page)
        except PageNotAnInteger:
            # If page is not an integer, deliver first page.
            show_data = paginator.page(1)
        except EmptyPage:
            # If page is out of range (e.g. 9999), deliver last page of results.
            show_data = paginator.page(paginator.num_pages)
        context['show_data'] = show_data
        context['this_mission'] = Mission.objects.get(id=self.kwargs['mission'])
        context['this_test'] = TestDetail.objects.get(id=self.kwargs['test_detail'])
        return context 
Example #19
Source File: views.py    From CATEd with MIT License 6 votes vote down vote up
def index(request):
    transaction = Transaction.objects.all().order_by('-date')
    if len(transaction) > 0:
        paginator = Paginator(transaction, 100)
        page = request.GET.get('page')
        try:
            transactions = paginator.page(page)
        except PageNotAnInteger:
            transactions = paginator.page(1)
        except EmptyPage:
            transactions = paginator.page(paginator.num_pages)
    else:
        transactions = None
    args = {'exchange_form': UserExchangesForm(),
            'wallet_form': UserWalletForm(),
            'ue': UserExchange.objects.all(),
            'uw': UserWallet.objects.all(),
            'trans': transactions}
    return render(request, 'trade/home.html', args) 
Example #20
Source File: views.py    From Collaboration-System with GNU General Public License v2.0 6 votes vote down vote up
def feed_content(request, pk):
	grpfeeds = ''
	try:
		group = Group.objects.get(pk=pk)
		uid = request.user.id
		membership = GroupMembership.objects.get(user=uid, group=group.pk)
		if membership:
			gfeeds = group.target_actions.all()
			page = request.GET.get('page', 1)
			paginator = Paginator(list(gfeeds), 10)
			try:
				grpfeeds = paginator.page(page)
			except PageNotAnInteger:
				grpfeeds = paginator.page(1)
			except EmptyPage:
				grpfeeds = paginator.page(paginator.num_pages)

	except GroupMembership.DoesNotExist:
		return redirect('group_view', group.pk)
	return render(request, 'groupfeed.html', {'group': group, 'membership':membership, 'grpfeeds':grpfeeds}) 
Example #21
Source File: generic.py    From aswan with GNU Lesser General Public License v2.1 6 votes vote down vote up
def validate_number(self, number):
        """
        Validates the given 1-based page number.
        """
        try:
            number = int(number)
        except (TypeError, ValueError):
            raise PageNotAnInteger('That page number is not an integer')
        if number < 1:
            raise EmptyPage('That page number is less than 1')
        if number > self.num_pages:
            if number == 1 and self.allow_empty_first_page:
                pass
            else:
                number = self.num_pages
        return number 
Example #22
Source File: models.py    From WF-website with GNU Affero General Public License v3.0 6 votes vote down vote up
def get_paginated_archive_issues(self, archive_issues, request):
        items_per_page = 9

        paginator = Paginator(archive_issues, items_per_page)

        archive_issues_page = request.GET.get("page")

        try:
            paginated_archive_issues = paginator.page(archive_issues_page)
        except PageNotAnInteger:
            # If page is not an integer, deliver first page.
            paginated_archive_issues = paginator.page(1)
        except EmptyPage:
            # If page is out of range (e.g. 9999), deliver last page of results.
            paginated_archive_issues = paginator.page(paginator.num_pages)

        return paginated_archive_issues 
Example #23
Source File: api.py    From KubeOperator with Apache License 2.0 5 votes vote down vote up
def list(self, request, *args, **kwargs):
        user = request.user
        limit = request.query_params.get('limit')
        page = request.query_params.get('page')
        type = request.query_params.get('type')
        level = request.query_params.get('level')
        readStatus = request.query_params.get('readStatus')
        user_messages = UserMessage.objects.filter(user_id=user.id,
                                                   send_type=UserMessage.MESSAGE_SEND_TYPE_LOCAL).values()
        if readStatus != 'ALL':
            user_messages = user_messages.filter(read_status=readStatus)
        if type != 'ALL':
            ids = Message.objects.filter(type=type).values_list('id')
            user_messages = user_messages.filter(message_id__in=ids)
        if level != 'ALL':
            l_ids = Message.objects.filter(level=level).values_list('id')
            user_messages = user_messages.filter(message_id__in=l_ids)
        paginator = Paginator(user_messages, limit)
        try:
            user_messages = paginator.page(page)
        except PageNotAnInteger:
            user_messages = paginator.page(1)
        except EmptyPage:
            user_messages = paginator.page(paginator.num_pages)
        for user_message in user_messages:
            user_message['message_detail'] = Message.objects.filter(id=user_message['message_id']).values()[0]

        return JsonResponse(data={"total": paginator.count,
                                  "page_num": paginator.num_pages,
                                  "data": list(user_messages.object_list)}) 
Example #24
Source File: views.py    From monasca-ui with Apache License 2.0 5 votes vote down vote up
def get_data(self):
        page_offset = self.request.GET.get('page_offset')
        results = []
        if page_offset is None:
            page_offset = 0
        limit = utils.get_page_size(self.request)
        try:
            results = api.monitor.notification_list(self.request, page_offset, limit)
            paginator = Paginator(results, limit)
            results = paginator.page(1)
        except EmptyPage:
            results = paginator.page(paginator.num_pages)
        except Exception:
            messages.error(self.request, _("Could not retrieve notifications"))
        return results 
Example #25
Source File: views.py    From monasca-ui with Apache License 2.0 5 votes vote down vote up
def get_data(self):
        page_offset = self.request.GET.get('page_offset')
        contacts = []

        if page_offset is None:
            page_offset = 0

        limit = utils.get_page_size(self.request)
        if self.service == default_service:
            try:
                results = api.monitor.alarm_list(self.request, page_offset,
                                                 limit)
                paginator = Paginator(results, limit)
                contacts = paginator.page(1)
            except EmptyPage:
                contacts = paginator.page(paginator.num_pages)
            except Exception:
                messages.error(self.request, _("Could not retrieve alarms"))
            return contacts
        else:
            if self.service[:2] == 'id':
                try:
                    name, value = self.service.split("=")
                    results = [api.monitor.alarm_show(self.request, value)]
                except Exception:
                    messages.error(self.request, _("Could not retrieve alarms"))
                    results = []
                return results
            else:
                try:
                    if self.service[:3] == 'b64':
                        name, value = self.service.split(":")
                        self.service = base64.urlsafe_b64decode(str(value)).decode('utf-8')
                    results = api.monitor.alarm_list_by_dimension(self.request,
                                                                  self.service,
                                                                  page_offset,
                                                                  limit)
                except Exception:
                    messages.error(self.request, _("Could not retrieve alarms"))
                    results = []
                return results 
Example #26
Source File: views.py    From monasca-ui with Apache License 2.0 5 votes vote down vote up
def get_data(self):
        page_offset = self.request.GET.get('page_offset')
        ts_mode = self.request.GET.get('ts_mode')
        ts_offset = self.request.GET.get('ts_offset')

        contacts = []
        object_id = self.kwargs['id']
        name = self.kwargs['name']

        if not ts_mode:
            ts_mode = alarm_history_default_ts_format
        if not page_offset:
            page_offset = 0
        limit = utils.get_page_size(self.request)
        try:
            results = api.monitor.alarm_history(self.request, object_id, page_offset, limit)
            paginator = Paginator(results, limit)
            contacts = paginator.page(1)
        except EmptyPage:
            contacts = paginator.page(paginator.num_pages)
        except Exception:
            messages.error(self.request,
                           _("Could not retrieve alarm history for %s") % object_id)

        try:
            return transform_alarm_history(contacts, name, ts_mode, ts_offset)
        except ValueError as err:
            LOG.warning('Failed to transform alarm history due to %s' %
                        err.message)
            messages.warning(self.request, _('Failed to present alarm '
                                             'history'))
        return [] 
Example #27
Source File: views.py    From Collaboration-System with GNU General Public License v2.0 5 votes vote down vote up
def group_content(request, pk):
	grparticles = ''
	try:
		group = Group.objects.get(pk=pk)
		uid = request.user.id
		membership = GroupMembership.objects.get(user=uid, group=group.pk)
		if membership:
			garticles = GroupArticles.objects.raw('select "article" as type , ba.id, ba.title, ba.body, ba.image, ba.views, ba.created_at, username, workflow_states.name as state from  workflow_states, auth_user au, BasicArticle_articles as ba , Group_grouparticles as ga  where au.id=ba.created_by_id and ba.state_id=workflow_states.id and  ga.article_id =ba.id and ga.group_id=%s and ba.state_id in (select id from workflow_states as w where w.name = "visible" or w.name="private");', [group.pk])
			gmedia = GroupMedia.objects.raw('select "media" as type, media.id, media.title, media.mediafile as image, media.mediatype, media.created_at, username, workflow_states.name as state from workflow_states, Media_media as media, Group_groupmedia as gmedia, auth_user au where au.id=media.created_by_id and media.state_id=workflow_states.id and media.id=gmedia.media_id and gmedia.group_id=%s and media.state_id in (select id from workflow_states as w where w.name = "visible" or w.name="private");', [group.pk])

			gh5p = []
			try:
				response = requests.get(settings.H5P_ROOT + 'h5p/h5papi/?format=json')
				json_data = json.loads(response.text)
				print(json_data)

				for obj in json_data:
					if obj['group_id'] == group.pk:
						gh5p.append(obj)
			except Exception as e:
				print(e)
				print("H5P server down...Sorry!! We will be back soon")

			lstfinal = list(garticles) + list(gmedia) + list(gh5p)
			page = request.GET.get('page', 1)
			paginator = Paginator(list(lstfinal), 5)
			try:
				grparticles = paginator.page(page)
			except PageNotAnInteger:
				grparticles = paginator.page(1)
			except EmptyPage:
				grparticles = paginator.page(paginator.num_pages)

	except GroupMembership.DoesNotExist:
		return redirect('group_view', group.pk)
	return render(request, 'groupcontent.html', {'group': group, 'membership':membership, 'grparticles':grparticles}) 
Example #28
Source File: views.py    From django_reddit with Apache License 2.0 5 votes vote down vote up
def frontpage(request):
    """
    Serves frontpage and all additional submission listings
    with maximum of 25 submissions per page.
    """
    # TODO: Serve user votes on submissions too.

    all_submissions = Submission.objects.order_by('-score').all()
    paginator = Paginator(all_submissions, 25)

    page = request.GET.get('page', 1)
    try:
        submissions = paginator.page(page)
    except PageNotAnInteger:
        raise Http404
    except EmptyPage:
        submissions = paginator.page(paginator.num_pages)

    submission_votes = {}

    if request.user.is_authenticated():
        for submission in submissions:
            try:
                vote = Vote.objects.get(
                    vote_object_type=submission.get_content_type(),
                    vote_object_id=submission.id,
                    user=RedditUser.objects.get(user=request.user))
                submission_votes[submission.id] = vote.value
            except Vote.DoesNotExist:
                pass

    return render(request, 'public/frontpage.html', {'submissions'     : submissions,
                                                     'submission_votes': submission_votes}) 
Example #29
Source File: views.py    From Collaboration-System with GNU General Public License v2.0 5 votes vote down vote up
def display_courses(request):
	courselist = CommunityCourses.objects.filter(course__state__name='publish')
	page = request.GET.get('page', 1)
	paginator = Paginator(list(courselist), 5)
	try:
		courses = paginator.page(page)
	except PageNotAnInteger:
		courses = paginator.page(1)
	except EmptyPage:
		courses = paginator.page(paginator.num_pages)
	return render(request, 'courses.html',{'courses':courses}) 
Example #30
Source File: views.py    From osler with GNU General Public License v3.0 5 votes vote down vote up
def dashboard_attending(request):

    provider = request.user.provider

    clinic_list = ClinicDate.objects.filter(workup__attending=provider)

    paginator = Paginator(clinic_list, settings.OSLER_CLINIC_DAYS_PER_PAGE,
                          allow_empty_first_page=True)

    page = request.GET.get('page')
    try:
        clinics = paginator.page(page)
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        clinics = paginator.page(1)
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of results.
        clinics = paginator.page(paginator.num_pages)

    no_note_patients = Patient.objects.filter(workup=None).order_by('-pk')[:20]

    return render(request,
                  'dashboard/dashboard-attending.html',
                  {'clinics': clinics,
                   'no_note_patients': no_note_patients
                   })