﻿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
22817	Missing custom methods on EmptyQuerySet	benjaoming	nobody	"#19151 was basically reintroduced in 1.6 -- recap of the release notes:

> The django.db.models.query.EmptyQuerySet can’t be instantiated any more - it is only usable as a marker class for checking if none() has been called: isinstance(qs.none(), EmptyQuerySet)

Thus, if we try the case of #19151 in 1.7:


{{{
>>> AnonymousUser().groups.value_list('name') 
Traceback (most recent call last):
  File ""<input>"", line 1, in <module>
AttributeError: 'EmptyManager' object has no attribute 'value_list'

}}}

I also have this issue in django-wiki and I don't know how to solve it: https://github.com/benjaoming/django-wiki/issues/216 (sorry it doesn't contain many details yet)

The problem with the above is that basically when we have a custom manager and we want to call a custom function, we have to always check that we do not have an instance of EmptyQuerySet. I mean, how else can we call a custom method on a custom QuerySet if it's always subject to be an instance of a non-custom EmptyQuerySet ? :)

I'm seeing behaviour as broken and should be reverted, but please correct me if I'm wrong and there's a way around this.

I've heard that 1.7 will have a QuerySet.as_manager utility method, but this doesn't fix heaps of broken managers that rely on their own instances of EmptyQuerySet and cannot simply stop instantiating them because they use none() to transparently implement the same call pattern for both empty and non-empty querysets.

In addition, maintaining compatibility of managers across 1.5 - 1.7 seems very painful without custom EmptyQuerySet instances."	Bug	closed	Database layer (models, ORM)	1.6	Release blocker	invalid			Accepted	0	0	0	0	0	0
