Skip to content

Remove the unused last_page context flag (#857) - #978

Open
vjpixel wants to merge 2 commits into
developfrom
feature/857-blog-index-last-page
Open

vjpixel wants to merge 2 commits into
developfrom
feature/857-blog-index-last-page

Conversation

@vjpixel

@vjpixel vjpixel commented Sep 17, 2026

Copy link
Copy Markdown
Member

Description

Reworked after reading @pablodiegoss's comment on the issue (#857), which I had not seen when I first opened this. He is right, and the first version of this PR was wrong: it fixed last_page's value when the correct fix is to delete it.

blog_index() set "last_page": page.has_previous() — the inverse of what the name promises — and nothing reads it. grep -rn last_page src/ finds only the assignment itself: no template, no other view, no test. So the "incorrect pagination" symptom described in the issue never existed, which is exactly what he could not reproduce.

This removes the flag.

Resolves (Issues)

Closes #857

General tasks performed

  • Deleted "last_page" from the blog_index() context.
  • Replaced the two regression tests from the first version with one test asserting the key is absent, so a flag with no reader does not come back.

Net diff against develop: one deleted line in src/blog/views.py plus one test.

Verification: pytest src/blog passes, 7 tests. ruff format --diff src/ clean; ruff check --extend-select I reports the same count as develop.

Have you confirmed the application builds locally without error? See here.

  • Yes

🤖 Generated with Claude Code

https://claude.ai/code/session_01HXUw7kyELDu8ycGQxtaFbb


Generated by Claude Code

blog_index() built its `last_page` context flag from `page.has_previous()`,
which is the inverse of what the name promises: False on the first page and
True on every other one.

The flag is not read by any template today, so nothing is visibly broken —
this is a latent bug that would mislead the first consumer of the variable.

Adds two regression tests covering the multi-page case (first, middle and
final page) and the single-page case, where the only page is also the last.

Closes #857

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXUw7kyELDu8ycGQxtaFbb
Per @pablodiegoss on #857: the flag is read by nothing — no template, no
view, no test — so fixing its value was the wrong call. It set
page.has_previous(), the inverse of what the name promises, and the
"pagination breaks" symptom in the issue never existed.

Removes it and replaces the earlier regression tests with one that keeps a
readerless flag from coming back.

Closes #857

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXUw7kyELDu8ycGQxtaFbb
@vjpixel vjpixel changed the title Fix inverted last_page logic in blog_index (#857) Remove the unused last_page context flag (#857) Sep 17, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

blog_index view has inverted last_page logic using has_previous() instead of not has_next()

2 participants