moshthepitt / django-pagination

Automatically exported from code.google.com/p/django-pagination
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Documentation: clarify placement of "autopaginate" tag #44

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In order for the ``render'' method to be called on AutoPaginateNode, the
``{% autopaginate object_list %}'' tag must be placed in a section of a
template that is rendered.  A common case where a tag might be placed in a
non-rendered area is if you are using template inheritance.  For example,
the following does not work:

{{{
{% extends "base.html %}
{% load pagination_tags
{% autopaginate object_list %}
{% block body %}
{% for object in object_list %}
...
{% endfor %}
{% endblock %}
}}}

Instead, the autopaginate tag must be moved inside the "body" block to
work.  Since the autopaginate tag doesn't output anything (it simply
changes the context), this restriction isn't automatically intuitive.

Simply clarifying this in the documentation should be sufficient, if there
isn't a good way to make the tag function without "render" getting called.

Original issue reported on code.google.com by cha...@gmail.com on 27 Mar 2009 at 10:30