Skip to content

Fix TemplateSyntaxError on publisher detail page - #600

Merged
bpepple merged 1 commit into
masterfrom
translation-exception
Aug 15, 2026
Merged

Fix TemplateSyntaxError on publisher detail page#600
bpepple merged 1 commit into
masterfrom
translation-exception

Conversation

@bpepple

@bpepple bpepple commented Aug 15, 2026

Copy link
Copy Markdown
Member

Summary

  • PublisherDetail.get_context_data (and the PublisherImprintsLoadMore/ PublisherUniversesLoadMore HTMX endpoints) fetched publisher.imprints/ publisher.universes without annotating series_count/issue_count
  • publisher_detail.html references those fields inside {% blocktrans count counter=... %} tags, so the counter resolved to a non-number and Django raised TemplateSyntaxError: 'counter' argument to 'blocktrans' tag must be a number
  • Any publisher with at least one imprint or universe hit this (reported via /publisher/idw-publishing/ 500 in production logs)
  • Annotates the imprint/universe querysets with series_count/issue_count subqueries, mirroring the pattern already used in imprint.py/universe.py

Annotate imprints/universes querysets with series_count/issue_count in PublisherDetail and its HTMX load-more endpoints. The templates '{% blocktrans count %} tags reference these fields, but the querysets were unannotated, causing a TemplateSyntaxError whenever a publisher had imprints or universes (e.g. /publisher/idw-publishing/).
@bpepple bpepple self-assigned this Aug 15, 2026
@bpepple bpepple added the bug Something isn't working label Aug 15, 2026
@bpepple
bpepple merged commit d68cfd6 into master Aug 15, 2026
2 checks passed
@bpepple
bpepple deleted the translation-exception branch August 15, 2026 23:02
bpepple added a commit that referenced this pull request Aug 16, 2026
Coalesce the imprint series_count/universe issue_count subqueries to 0. A correlated Subquery returns NULL (not 0) when an imprint has no series or a universe has no issues, which still tripped the blocktrans counter TemplateSyntaxError the prior fix in #600 didn't cover (e.g. dc-comics, which has several empty imprints/universes).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant