1 # Copyright (c) 2008, Eric Florenzano
 
   2 # Copyright (c) 2010, 2011 Linaro Limited
 
   5 # Redistribution and use in source and binary forms, with or without
 
   6 # modification, are permitted provided that the following conditions are
 
   9 #     * Redistributions of source code must retain the above copyright
 
  10 #       notice, this list of conditions and the following disclaimer.
 
  11 #     * Redistributions in binary form must reproduce the above
 
  12 #       copyright notice, this list of conditions and the following
 
  13 #       disclaimer in the documentation and/or other materials provided
 
  14 #       with the distribution.
 
  15 #     * Neither the name of the author nor the names of other
 
  16 #       contributors may be used to endorse or promote products derived
 
  17 #       from this software without specific prior written permission.
 
  19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
  20 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
  21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 
  22 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 
  23 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
  24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 
  25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 
  26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 
  27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
  28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
  29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
  32 from django.conf import settings
 
  35 DEFAULT_PAGINATION = getattr(
 
  36     settings, 'PAGINATION_DEFAULT_PAGINATION', 20)
 
  37 DEFAULT_WINDOW = getattr(
 
  38     settings, 'PAGINATION_DEFAULT_WINDOW', 4)
 
  39 DEFAULT_MARGIN = getattr(
 
  40     settings, 'PAGINATION_DEFAULT_MARGIN', DEFAULT_WINDOW)
 
  41 DEFAULT_ORPHANS = getattr(
 
  42     settings, 'PAGINATION_DEFAULT_ORPHANS', 0)
 
  43 INVALID_PAGE_RAISES_404 = getattr(
 
  44     settings, 'PAGINATION_INVALID_PAGE_RAISES_404', False)
 
  45 DISPLAY_PAGE_LINKS = getattr(
 
  46     settings, 'PAGINATION_DISPLAY_PAGE_LINKS', True)
 
  47 PREVIOUS_LINK_DECORATOR = getattr(
 
  48     settings, 'PAGINATION_PREVIOUS_LINK_DECORATOR', "‹‹ ")
 
  49 NEXT_LINK_DECORATOR = getattr(
 
  50     settings, 'PAGINATION_NEXT_LINK_DECORATOR', " ››")
 
  51 DISPLAY_DISABLED_PREVIOUS_LINK = getattr(
 
  52     settings, 'PAGINATION_DISPLAY_DISABLED_PREVIOUS_LINK', False)
 
  53 DISPLAY_DISABLED_NEXT_LINK = getattr(
 
  54     settings, 'PAGINATION_DISPLAY_DISABLED_NEXT_LINK', False)
 
  55 DISABLE_LINK_FOR_FIRST_PAGE = getattr(
 
  56     settings, 'PAGINATION_DISABLE_LINK_FOR_FIRST_PAGE', True)