#29272: Queryset using order_by(F()) fails to compile with values_list
-------------------------------------+-------------------------------------
               Reporter:  bszfw      |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  2.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          |
-------------------------------------+-------------------------------------
 Here is a simplified version of what I am trying to do:

 {{{
 from django.db import models
 from django.db.models import IntegerField, F, Value

 class Question(models.Model):
     question_text = models.CharField(max_length=200)
     pub_date = models.DateTimeField('date published')

     def __str__(self):
         return self.question_text

 Question.objects.annotate(test=Value(1,
 output_field=IntegerField())).order_by(F('test')).values_list('question_text')
 }}}

 It works without using {{{F}}}, or by adding the annotated value to
 {{{values_list}}}.
 But I need {{{F}}} to be able to write
 {{{F('test').asc(nulls_last=True)}}}, and I cannot modify
 {{{values_list}}} as it is added to the Queryset later in code which does
 not know anything about the annotation.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29272>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/048.49ef73b6f66a09c352ee716b56877513%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to