﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18354	Duplicate query in archive and year class based views	Aymeric Augustin	nobody	"In !BaseArchiveIndexView and !BaseYearArchiveView, `get_dated_items`:
- calls `get_dated_queryset`, which is going trigger the evaluation of said queryset (unless pagination is enabled);
- adds a new ordering clause on the queryset before making it the `object_list`.

Because of the added ordering clause, the queryset will be re-evaluated when accessing `context['object_list']` / `context[context_object_name]`.

The ordering clause should probably be moved into `get_dated_queryset`. There are two ways to achieve this:
- Add an optional `ordering` parameter to `get_dated_queryset`. This is the fastest solution and it'll be totally backwards compatible.
- Add an API to control the order of the queryset for all views. Currently no order is enforced, unless the model's `meta.ordering` is set -- which is often a bad practice as it adds the sorting overhead to every query involving the models.

I'm probably going to adopt the first solution to fix this problem. The second is a larger feature request."	Bug	closed	Generic views	1.4	Normal	fixed			Unreviewed	0	0	0	0	0	0
