Fix TemplateSyntaxError on publisher detail page - #600
Merged
Conversation
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
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PublisherDetail.get_context_data(and thePublisherImprintsLoadMore/PublisherUniversesLoadMoreHTMX endpoints) fetchedpublisher.imprints/publisher.universeswithout annotatingseries_count/issue_countpublisher_detail.htmlreferences those fields inside{% blocktrans count counter=... %}tags, so the counter resolved to a non-number and Django raisedTemplateSyntaxError: 'counter' argument to 'blocktrans' tag must be a number/publisher/idw-publishing/500 in production logs)series_count/issue_countsubqueries, mirroring the pattern already used inimprint.py/universe.py