﻿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
31496	Combined queryset crash when chaining `values()` after `order_by()` with annotated constants.	GardenLee	David Wobrock	"When I tried query with 'annotate', 'union', 'order_by('annotate_field')' and 'values' at the same time, i got AttributeError('NoneType' object has no attribute 'split')

ex)
# 1. make 2 QuerySets
{{{
qs1 = Foo.objects.annotate(bar_val=Value(1, output_field=IntegerField())).filter(bar=False)
qs2 = Foo.objects.annotate(bar_val=Value(2, output_field=IntegerField())).filter(bar=True)
}}}


# 2. union
{{{
qs3 = qs1.union(qs2)
}}}

# 3. order_by annotate field
{{{
qs4 = qs3.order_by('bar_val')
}}}

# 4. get values
{{{
qs4.values('id')
}}}

In this case, I confirmed ('id', None) tuple passed by compiler.query.set_values() in django/db/models/sql/compiler.py
"	Bug	closed	Database layer (models, ORM)	3.0	Normal	fixed		Hasan Ramezani David Wobrock	Ready for checkin	1	0	0	0	0	0
