Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#9215 closed (fixed)

Implementation example for paginaton

Reported by: Scot Hacker Owned by: nobody
Component: Documentation Version: 1.0
Severity: Keywords: pagination
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

This patch demonstrates a working example of Pagination, in addition to the shell example currently provide in the Pagination docs.

Attachments (1)

pagination.diff (2.2 KB ) - added by Scot Hacker 16 years ago.
Formatting corrections to original patch

Download all attachments as: .zip

Change History (7)

comment:1 by Scot Hacker, 16 years ago

Original version of this documentation courtesy Matt Dennenbaum, who assisted with this patch.
http://www.ninjacipher.com/2008/08/04/new-django-paginator-example/

comment:2 by Malcolm Tredinnick, 16 years ago

milestone: post-1.0
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

There are lots of markup errors visible from just reading through this. Have you actually applied it, run "make html" in the docs directory and viewed the output? Things that I noticed are

  • Underlines of headings must be at least as long as the thing they are underlining.
  • Text preceding a code fragment that ends with ":" should be written as "::" so that the code fragment is marked up as code (in multiple places the code fragments won't be converted to HTML code fragments).
  • The {#...#} template tag is for single line comments, not comments containing a newline. Start and end markers must be on the same line. The code example given won't actually work as written.
  • The text that starts with a double dot (things like ".. In views.py") looks odd. It should be just normal text introducing the code.

We might end up putting this somewhere else (in a separate file, for example), but it looks useful. However, the markup and code should all be correct before we can go further.

comment:3 by Scot Hacker, 16 years ago

Thanks for the tips - I wasn't aware of the documentation build system. May I suggest a link to http://docs.djangoproject.com/en/dev/internals/documentation/ on the ticket submission form for documentation submittors?

This second patch builds fine and addresses all of your points above.

by Scot Hacker, 16 years ago

Attachment: pagination.diff added

Formatting corrections to original patch

comment:4 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

(In [9193]) Fixed #9215 -- Added a view/template example of using pagination.
Based on a patch from shacker and Matt Dennenbaum.

comment:5 by Malcolm Tredinnick, 16 years ago

You'll see in the final patch that I've changed a few things to remove some extraneous code that wasn't strictly relevant to the example (so that it stays as small as possible). I also changed the place where you were using the __repr__ method in the template (as {{ contacts }}), since that output is for internal use, not a public display string.

@shacker: if you want to open another ticket with a patch against the AUTHORS file if you're not already in there, please do so.

comment:6 by Malcolm Tredinnick, 16 years ago

(In [9196]) [1.0.X] Fixed #9215 -- Added a view/template example of using pagination.
Based on a patch from shacker and Matt Dennenbaum.

Backport of r9193 from trunk.

Note: See TracTickets for help on using tickets.
Back to Top