# Path: endless_pagination/decorators.py
# def page_template(template, key=PAGE_LABEL):
#     """Return a view dynamically switching template if the request is Ajax.
# 
#     Decorate a view that takes a *template* and *extra_context* keyword
#     arguments (like generic views).
#     The template is switched to *page_template* if request is ajax and
#     if *querystring_key* variable passed by the request equals to *key*.
#     This allows multiple Ajax paginations in the same page.
#     The name of the page template is given as *page_template* in the
#     extra context.
#     """
#     def decorator(view):
#         @wraps(view)
#         def decorated(request, *args, **kwargs):
#             # Trust the developer: he wrote ``context.update(extra_context)``
#             # in his view.
#             extra_context = kwargs.setdefault('extra_context', {})
#             extra_context['page_template'] = template
#             # Switch the template when the request is Ajax.
#             if request.method == 'POST':
#                 querystring_key = request.POST.get(
#                     'querystring_key', PAGE_LABEL)
#             else:
#                 querystring_key = request.GET.get(
#                     'querystring_key', PAGE_LABEL)
#             if request.is_ajax() and querystring_key == key:
#                 kwargs[TEMPLATE_VARNAME] = template
#             return view(request, *args, **kwargs)
#         return decorated
# 
#     return decorator
# 
# def page_templates(mapping):
#     """Like the *page_template* decorator but manage multiple paginations.
# 
#     You can map multiple templates to *querystring_keys* using the *mapping*
#     dict, e.g.::
# 
#         @page_templates({
#             'page_contents1.html': None,
#             'page_contents2.html': 'go_to_page',
#         })
#         def myview(request):
#             ...
# 
#     When the value of the dict is None then the default *querystring_key*
#     (defined in settings) is used. You can use this decorator instead of
#     chaining multiple *page_template* calls.
#     """
#     def decorator(view):
#         @wraps(view)
#         def decorated(request, *args, **kwargs):
#             # Trust the developer: he wrote ``context.update(extra_context)``
#             # in his view.
#             extra_context = kwargs.setdefault('extra_context', {})
# 
#             if request.method == 'POST':
#                 querystring_key = request.POST.get(
#                     'querystring_key', PAGE_LABEL)
#             else:
#                 querystring_key = request.GET.get(
#                     'querystring_key', PAGE_LABEL)
#             template = _get_template(querystring_key, mapping)
#             extra_context['page_template'] = template
#             # Switch the template when the request is Ajax.
#             if request.is_ajax() and template:
#                 kwargs[TEMPLATE_VARNAME] = template
#             return view(request, *args, **kwargs)
#         return decorated
# 
#     return decorator


from django.conf.urls import url
from django.views.generic import TemplateView
from endless_pagination.decorators import (
    page_template,
    page_templates,
)
from project.views import generic
        name='home'),
    url(r'^complete/$',
        page_templates({
            'complete/objects_page.html': 'objects-page',
            'complete/items_page.html': 'items-page',
            'complete/entries_page.html': 'entries-page',
            'complete/articles_page.html': 'articles-page',
        })(generic),
        {'template': 'complete/index.html', 'number': 21},
        name='complete'),
    url(r'^digg/$',
        page_template('digg/page.html')(generic),
        {'template': 'digg/index.html'},
        name='digg'),
    url(r'^twitter/$',
        page_template('twitter/page.html')(generic),
        {'template': 'twitter/index.html'},
        name='twitter'),
    url(r'^onscroll/$',
        page_template('onscroll/page.html')(generic),
        {'template': 'onscroll/index.html'},
        name='onscroll'),
    url(r'^chunks/$',
        page_templates({
            'chunks/objects_page.html': None,
            'chunks/items_page.html': 'items-page',
        })(generic),
        {'template': 'chunks/index.html', 'number': 50},
        name='chunks'),
    url(r'^multiple/$',

# Path: endless_pagination/decorators.py
# def page_template(template, key=PAGE_LABEL):
#     """Return a view dynamically switching template if the request is Ajax.
# 
#     Decorate a view that takes a *template* and *extra_context* keyword
#     arguments (like generic views).
#     The template is switched to *page_template* if request is ajax and
#     if *querystring_key* variable passed by the request equals to *key*.
#     This allows multiple Ajax paginations in the same page.
#     The name of the page template is given as *page_template* in the
#     extra context.
#     """
#     def decorator(view):
#         @wraps(view)
#         def decorated(request, *args, **kwargs):
#             # Trust the developer: he wrote ``context.update(extra_context)``
#             # in his view.
#             extra_context = kwargs.setdefault('extra_context', {})
#             extra_context['page_template'] = template
#             # Switch the template when the request is Ajax.
#             if request.method == 'POST':
#                 querystring_key = request.POST.get(
#                     'querystring_key', PAGE_LABEL)
#             else:
#                 querystring_key = request.GET.get(
#                     'querystring_key', PAGE_LABEL)
#             if request.is_ajax() and querystring_key == key:
#                 kwargs[TEMPLATE_VARNAME] = template
#             return view(request, *args, **kwargs)
#         return decorated
# 
#     return decorator
# 
# def page_templates(mapping):
#     """Like the *page_template* decorator but manage multiple paginations.
# 
#     You can map multiple templates to *querystring_keys* using the *mapping*
#     dict, e.g.::
# 
#         @page_templates({
#             'page_contents1.html': None,
#             'page_contents2.html': 'go_to_page',
#         })
#         def myview(request):
#             ...
# 
#     When the value of the dict is None then the default *querystring_key*
#     (defined in settings) is used. You can use this decorator instead of
#     chaining multiple *page_template* calls.
#     """
#     def decorator(view):
#         @wraps(view)
#         def decorated(request, *args, **kwargs):
#             # Trust the developer: he wrote ``context.update(extra_context)``
#             # in his view.
#             extra_context = kwargs.setdefault('extra_context', {})
# 
#             if request.method == 'POST':
#                 querystring_key = request.POST.get(
#                     'querystring_key', PAGE_LABEL)
#             else:
#                 querystring_key = request.GET.get(
#                     'querystring_key', PAGE_LABEL)
#             template = _get_template(querystring_key, mapping)
#             extra_context['page_template'] = template
#             # Switch the template when the request is Ajax.
#             if request.is_ajax() and template:
#                 kwargs[TEMPLATE_VARNAME] = template
#             return view(request, *args, **kwargs)
#         return decorated
# 
#     return decorator


# Path: tests/project/urls.py
from django.conf.urls import url
from django.views.generic import TemplateView
from endless_pagination.decorators import (
    page_template,
    page_templates,
)
from project.views import generic

        name='home'),
    url(r'^complete/$',
        page_templates({
            'complete/objects_page.html': 'objects-page',
            'complete/items_page.html': 'items-page',
            'complete/entries_page.html': 'entries-page',
            'complete/articles_page.html': 'articles-page',
        })(generic),
        {'template': 'complete/index.html', 'number': 21},
        name='complete'),
    url(r'^digg/$',
        page_template('digg/page.html')(generic),
        {'template': 'digg/index.html'},
        name='digg'),
    url(r'^twitter/$',
        page_template('twitter/page.html')(generic),
        {'template': 'twitter/index.html'},
        name='twitter'),
    url(r'^onscroll/$',
        page_template('onscroll/page.html')(generic),
        {'template': 'onscroll/index.html'},
        name='onscroll'),
    url(r'^chunks/$',
        page_templates({
            'chunks/objects_page.html': None,
            'chunks/items_page.html': 'items-page',
        })(generic),
        {'template': 'chunks/index.html', 'number': 50},
        name='chunks'),
    url(r'^multiple/$',

        page_templates({