AnonymousUser.groups
breaks down it's facade with values()
, values_list()
:
>>> AnonymousUser().groups.values_list('name')
Traceback (most recent call last):
File "<snip>", line 1, in <module>
File "<snip>/django/db/models/manager.py", line 182, in values_list
return self.get_query_set().values_list(*args, **kwargs)
File "<snip>/django/db/models/query.py", line 585, in values_list
_fields=fields)
File "<snip>/django/db/models/query.py", line 1138, in _clone
c = super(EmptyQuerySet, self)._clone(klass, setup=setup, **kwargs)
File "<snip>/django/db/models/query.py", line 864, in _clone
c._setup_query()
File "<snip>/django/db/models/query.py", line 988, in _setup_query
self.query.add_fields(self.field_names, True)
File "<snip>/django/db/models/sql/query.py", line 1643, in add_fields
alias = self.get_initial_alias()
File "<snip>/django/db/models/sql/query.py", line 840, in get_initial_alias
alias = self.join((None, self.model._meta.db_table, None, None))
AttributeError: 'NoneType' object has no attribute '_meta'
>>> AnonymousUser().groups.values_list()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "<snip>/django/db/models/manager.py", line 182, in values_list
return self.get_query_set().values_list(*args, **kwargs)
File "<snip>/django/db/models/query.py", line 585, in values_list
_fields=fields)
File "<snip>/django/db/models/query.py", line 1138, in _clone
c = super(EmptyQuerySet, self)._clone(klass, setup=setup, **kwargs)
File "<snip>/django/db/models/query.py", line 864, in _clone
c._setup_query()
File "<snip>/django/db/models/query.py", line 982, in _setup_query
self.field_names = [f.attname for f in self.model._meta.fields]
AttributeError: 'NoneType' object has no attribute '_meta'
https://github.com/django/django/pull/456