Code

Opened 6 years ago

Closed 6 years ago

#6924 closed (invalid)

Paginator TemplateTag

Reported by: trbs Owned by: nobody
Component: Documentation Version: master
Severity: Keywords: paginator, templatetag
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I've created a TemplateTag for using the new Paginator class directly from a template.
It might be nice to add this to the documentation of Paginator or maybe even the django code page.

Ofcourse most people will use the paginator from a view or a generic view, but there are also some
quite good use cases for paginating something directly in a template. For instance a related list or
a generic list of things which is not the main object_list of the page.

The tag and usage examples are at: http://www.djangosnippets.org/snippets/673/

It currently lacks support for 'first' and 'last' keywords on the page parameter. I'll add it soon.

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by telenieko

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

One of the points in django's template system is to avoid "programming" in the templates, so the paginator *should* be made in the view and passed to the template.
On the other side, django docs *do not* link outside themselves (or should not). Adding to code.djangoproject.com can be done by anyone PaginatorTag.

So either:

  • You can edit your own wiki page
  • You can link you snippet from the page I linked above
  • You can bring this to django-developers for discussion and if aplicable reopen the ticket. But, please, do it after we get 1.0 out! ;)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.