Changes between Initial Version and Version 1 of Ticket #24420, comment 2


Ignore:
Timestamp:
03/05/15 06:16:54 (8 years ago)
Author:
Josh Smeaton
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #24420, comment 2

    initial v1  
    33Funnily enough, being explicit worked before this patch:
    44
     5{{{
    56CaseTestModel.objects.filter(integer__lte=2).annotate(test=Case(
    67                When(integer=1, then=2),
     
    910                output_field=models.IntegerField(),
    1011            )).order_by(F('test').asc())
     12}}}
    1113
    1214The problem is that the same instance of each `When` clause has resolve_expression called on it multiple times. Once for the annotation, and once again for the order_by. The problem is that When.resolve_expression converts the Q() into a WhereNode(), and overwrites the condition property. It's not idempotent.
Back to Top