eulcommon.searchutil – Utilities for searching

This module contains utilities for searching.

eulcommon.searchutil.search_terms(q)

Takes a search string and parses it into a list of keywords and phrases.

eulcommon.searchutil.pages_to_show(paginator, page, page_labels={})

Generate a dictionary of pages to show around the current page. Show 3 numbers on either side of the specified page, or more if close to end or beginning of available pages.

Parameters:
  • paginator – django Paginator, populated with objects
  • page – number of the current page
  • page_labels – optional dictionary of page labels, keyed on page number
Return type:

dictionary; keys are page numbers, values are page labels

Django template tag to display pagination links for a paginated list of items.

Expects the following variables:
  • the current Page of a Paginator object
  • a dictionary of the pages to be displayed, in the format generated by eulcommon.searchutil.pages_to_show()
  • optional url params to include in pagination link (e.g., search terms when paginating search results)
  • optional first page label (only used when first page is not in list of pages to be shown)
  • optional last page label (only used when last page is not in list of pages to be shown)

Example use:

{% load search_utils %}

{% pagination_links paged_items show_pages  %}

Project Versions

Previous topic

eulcommon.djangoextras – Extensions and additions to django

Next topic

eulcore.binfile – Map binary data to Python objects

This Page