Changes between Initial Version and Version 1 of Ticket #24420, comment 2
- Timestamp:
- Mar 5, 2015, 12:16:54 AM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #24420, comment 2
initial v1 3 3 Funnily enough, being explicit worked before this patch: 4 4 5 {{{ 5 6 CaseTestModel.objects.filter(integer__lte=2).annotate(test=Case( 6 7 When(integer=1, then=2), … … 9 10 output_field=models.IntegerField(), 10 11 )).order_by(F('test').asc()) 12 }}} 11 13 12 14 The 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.