You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since I added a new model (Review) with a rating field, I have been calculating the ratings gathered from the Review Form and saving them to the Review Table. This meant that in order to be able to sort the products by their rating, I will need to save the average rating in the Product table or find out how to add a sortkey for the average rating.
The text was updated successfully, but these errors were encountered:
I managed to sort the average rating using annotation and the Avg() function on the Review rating field. However, the reviews with no rating are showing up first when sorting is desc and vice versa.
was conflicting with the desc(nulls_last=True). Sortkey needed to be placed in the F() with desc(nulls_last=True) and then order the products by the new variable "order_logic".
Since I added a new model (Review) with a rating field, I have been calculating the ratings gathered from the Review Form and saving them to the Review Table. This meant that in order to be able to sort the products by their rating, I will need to save the average rating in the Product table or find out how to add a sortkey for the average rating.
The text was updated successfully, but these errors were encountered: