#31496: When using 'annotate', 'union', 'order_by('annotate_field')' and
'values'
at the same time, error occurred
-------------------------------------+-------------------------------------
Reporter: GardenLee | Owner: nobody
Type: Bug | Status: new
Component: Database | Version: 3.0
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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
--
Ticket URL: <https://code.djangoproject.com/ticket/31496>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/049.013727bb9a51044caa7ca75af2ef63bd%40djangoproject.com.