[Answer]-Django โ€“ Article "trend" query

1๐Ÿ‘

โœ…

I guess the simpliest and most effective way to do is to add a trend_score field to your model and update it when the model is saved (you neeed to save the model anyways if you have a view count/comment count on it). Then you can easily filter by this field. You can fore sure do it somehow with SQL, but if you have to update the values you need to update already within your model, calculate also the score upon saving.

Leave a comment