Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#9215 closed (fixed)

Implementation example for paginaton

Reported by: shacker 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: UI/UX:

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 shacker 6 years ago.
Formatting corrections to original patch

Download all attachments as: .zip

Change History (7)

comment:1 Changed 6 years ago by shacker

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 6 years ago by mtredinnick

  • milestone post-1.0 deleted
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

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 Changed 6 years ago by shacker

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.

Changed 6 years ago by shacker

Formatting corrections to original patch

comment:4 Changed 6 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:5 Changed 6 years ago by mtredinnick

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 Changed 6 years ago by mtredinnick

(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