Friday, January 29, 2010

Django | Generic views | Django documentation

Took me forever to figure this out with generi views, but the I just don't read well. Here is an example template:
<p class=\"paginator\">
 <span class=\"step-links\">
  {% if page_obj.has_previous %}
   <a href=\"?page={{ page_obj.previous_page_number }}\"><</a>
  {% endif %}

  <span class=\"current\">
   Page <span class=\"this-page\">{{ page }}</span> of {{ paginator.num_pages }}

  {% if page_obj.has_next %}
   <a href=\"?page={{ page_obj.next_page_number }}\">></a>
  {% endif %}

"If the results are paginated, the context will contain these extra variables: paginator: An instance of django.core.paginator.Paginator. page_obj: An instance of django.core.paginator.Page." Django Generic views object_list:

No comments: