Skip to content

Fix bug caused by child having multiple terms set under the index order by classifier#617

Merged
vsalvino merged 3 commits intomainfrom
bug/fix-index-sort-term-with-multiple-terms
Jan 10, 2024
Merged

Fix bug caused by child having multiple terms set under the index order by classifier#617
vsalvino merged 3 commits intomainfrom
bug/fix-index-sort-term-with-multiple-terms

Conversation

@jlchilders11
Copy link
Copy Markdown
Contributor

Description of change

Currently, if a page has index_order_by_classifier set, and one or more of its live children have more than one ClassifierTerm under that classifier set, Django will return a programming error more than one row returned by a subquery used as an expression.

This makes sense, as it is trying to sort on an order that is non deterministic. To fix, we slice the queryset to only ever contain a single term, which should also always be the highest order term due to the default ordering for the classifier terms.

@jlchilders11 jlchilders11 requested a review from vsalvino January 9, 2024 21:26
@vsalvino vsalvino modified the milestones: 3.0.2, 3.0.3 Jan 9, 2024
Comment thread coderedcms/models/page_models.py
@vsalvino vsalvino merged commit 2b7d147 into main Jan 10, 2024
@vsalvino vsalvino deleted the bug/fix-index-sort-term-with-multiple-terms branch January 10, 2024 17:10
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.

2 participants