Changes between Initial Version and Version 2 of Ticket #19512


Ignore:
Timestamp:
Dec 31, 2012, 1:53:52 PM (11 years ago)
Author:
Aymeric Augustin
Comment:

The ORM isn't intended to be a complete abstraction to SQL; it's just a shortcut for the most common queries. Dropping to raw SQL (or .extra if you really need to) isn't a violation of the ORM concept; it's part of the ORM concept — at least, as understood in Django.

The docs talk about aggregating annotations, but not about re-annotating annotations. I'm not sure it's possible to support it while keeping the code complexity under control.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #19512

    • Property Triage Stage UnreviewedDesign decision needed
    • Property Type UncategorizedNew feature
  • Ticket #19512 – Description

    initial v2  
     1{{{
    12from django.db.models import Count, Sum, F
    23
     
    56               .annotate(total=F('a_count')+F('b_count')) \
    67               .order_by('total')
     8}}}
    79
    8 This query is going to raise '''AttributeError: 'ExpressionNode' object has no attribute 'split''''
     10This query is going to raise `AttributeError: 'ExpressionNode' object has no attribute 'split'`
    911
    1012I don't find any method in django ORM to support such kind of operations (in which two fields are involved).
Back to Top