﻿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	When using 'annotate', 'union', 'order_by('annotate_field')' and 'values' at the same time, error occurred	GardenLee	nobody	"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 query_set
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 = q1.union(q2)

# 3. order_by annotate field
qs4 = q3.order_by('bar_val')

# 4. get values
q4.values('id')

In this case, I confirmed ('id', None) tuple passed by compiler.query.set_values() in django/db/models/sql/compiler.py
"	Bug	new	Database layer (models, ORM)	3.0	Normal				Unreviewed	0	0	0	0	0	0
