To improve the usability of article sections, we sorted articles by date, title, and number of views. In addition, the ability to find information on articles of the section has been added. This feature is implemented through several checkboxes that add the column names for sorting in the URL of the page, respectively, the page is reloaded.
For example, there are several columns in the data model
For them we will do the sorting, which in the usual query would look like this
Article.objects.all().order_by('title', 'pub_date', 'views')
But since we use checkboxes, sorting options can be present, and I can be absent. But do not we write if else blocks for every combination of checkboxes? Of course not.