Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#30036 closed Cleanup/optimization (fixed)

Code example for using Paginator in a view makes redundant imports

Reported by: bhch Owned by: nobody
Component: Documentation Version: 2.1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The code example in this section:
Using Paginator in a view imports EmptyPage and PageNotAnInteger unnecessarily since Paginator.get_page() handles these exceptions internally.

I had to spend some time figuring out why these were imported and never used. I even thought the code example might be incomplete, until I checked the source code.

I think it's better to remove these imports as they leave the reader confused.

Change History (5)

comment:1 by Carlton Gibson, 6 years ago

Triage Stage: UnreviewedAccepted

Yep. Thanks. Would you like to make a PR for these changes, whilst they're fresh in your mind?

comment:2 by Greg W, 6 years ago

I'll take it if OP doesn't want to do it.

comment:3 by Carlton Gibson, 6 years ago

Thanks Greg. I already have a patch ready. I just wanted to see if the OP wanted to make a contribution...

comment:4 by GitHub <noreply@…>, 6 years ago

Resolution: fixed
Status: newclosed

In a394289b:

Fixed #30036 -- Removed unused imports in pagination example.

comment:5 by Carlton Gibson <carlton.gibson@…>, 6 years ago

In 8d741bd:

[2.1.x] Fixed #30036 -- Removed unused imports in pagination example.

Backport of a394289b58b1773c4959ed768fdb325c91b2b589 from master

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