Skip to content

Refactor reading_lists views to reduce duplication#554

Merged
bpepple merged 4 commits into
masterfrom
refactor
Jul 11, 2026
Merged

Refactor reading_lists views to reduce duplication#554
bpepple merged 4 commits into
masterfrom
refactor

Conversation

@bpepple

@bpepple bpepple commented Jul 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Extract shared reading-list visibility filtering and stat annotations into a ReadingListQuerySet (visible_to() / with_list_stats()), replacing four near-identical copies across ReadingListListView, SearchReadingListListView, UserReadingListListView, ReadingListDetailView, and ReadingListItemsLoadMore.
  • Add ReadingListFromSlugMixin / ManageReadingListMixin to remove duplicated slug-lookup dispatch(), test_func(), get_success_url(), and context-injection boilerplate from AssignReadingListToMetronView, RemoveIssueFromReadingListView, AddIssueWithAutocompleteView, AddIssuesFromSeriesView, and AddIssuesFromArcView.
  • Extract filter_issues_by_number_range() and add_issues_to_reading_list() helpers, deduplicating the issue-range filtering and beginning/end reorder logic shared by AddIssuesFromSeriesView and AddIssuesFromArcView (and dropping their noqa: PLR0912, PLR0915 complexity suppressions).
  • Extract the issue-type/series/publisher breakdown and featured-creators/top-characters computation out of ReadingListDetailView.get_context_data() into a standalone build_reading_list_breakdown_context() function.
  • Update reading_lists/TECHNICAL.md to document the new queryset methods, mixins, and helper functions.

No behavior changes — this is a pure internal refactor for maintainability.

bpepple added 4 commits July 11, 2026 10:44
Extract shared visibility filtering and stat annotations into a ReadingListQuerySet, add mixins for the slug-lookup/permission-check boilerplate repeated across several views, and factor out the issue-range filtering and reorder logic duplicated between AddIssuesFromSeriesView and AddIssuesFromArcView.
Move the issue-type/series/publisher breakdown and featured creators/characters computation into a standalone build_reading_list_breakdown_context() function.
@bpepple bpepple self-assigned this Jul 11, 2026
@bpepple bpepple added chore Miscellaneous drudgery reading list labels Jul 11, 2026
@bpepple
bpepple merged commit 6de03b8 into master Jul 11, 2026
2 checks passed
@bpepple
bpepple deleted the refactor branch July 11, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Miscellaneous drudgery reading list

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant