Django

Code

Ticket #9215 (closed: fixed)

Opened 9 months ago

Last modified 9 months ago

Implementation example for paginaton

Reported by: shacker Assigned to: nobody
Milestone: Component: Documentation
Version: 1.0 Keywords: pagination
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 1

Description

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

Attachments

pagination.diff (2.2 kB) - added by shacker on 09/27/08 11:47:48.
Formatting corrections to original patch

Change History

09/26/08 03:16:23 changed by shacker

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

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

09/26/08 23:53:25 changed by mtredinnick

  • needs_better_patch set to 1.
  • stage changed from Unreviewed to Accepted.
  • milestone deleted.

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.

09/27/08 11:47:06 changed 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.

09/27/08 11:47:48 changed by shacker

  • attachment pagination.diff added.

Formatting corrections to original patch

10/07/08 06:51:14 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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

10/07/08 06:53:43 changed 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.

10/07/08 06:58:42 changed 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.


Add/Change #9215 (Implementation example for paginaton)




Change Properties
Action