coderedcorp / coderedcms

Wagtail + CodeRed Extensions enabling rapid development of marketing-focused websites.
https://www.coderedcorp.com/cms
Other
685 stars 133 forks source link

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

Closed jlchilders11 closed 8 months ago

jlchilders11 commented 8 months ago

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.