﻿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
18087	Performance issue in date-based generic views	Aymeric Augustin	Aymeric Augustin	"When `BaseDateListView.allow_empty = False` -- which is the default -- `BaseDateListView.get_dated_queryset` evaluates the unpaginated queryset, unnecessarily loading the entire table into memory.

Suggested fix:

{{{

Index: django/views/generic/dates.py
===================================================================
--- django/views/generic/dates.py	(revision 17859)
+++ django/views/generic/dates.py	(working copy)
@@ -194,7 +194,7 @@
         if not allow_future:
             qs = qs.filter(**{'%s__lte' % date_field: timezone.now()})
 
-        if not allow_empty and not qs:
+        if not allow_empty and not qs.exists():
             raise Http404(_(u""No %(verbose_name_plural)s available"") % {
                     'verbose_name_plural': force_unicode(qs.model._meta.verbose_name_plural)
             })
}}}

At this point, I have no idea to capture this behavior in tests :("	Bug	closed	Generic views	1.4	Normal	fixed			Accepted	1	0	1	1	0	0
