#3566: Proposal of ORM extension -- aggregationu
-------------------------------------------------+--------------------------
   Reporter:  Honza Král <[EMAIL PROTECTED]>  |                Owner:  adrian   
       
     Status:  new                                |            Component:  
Database wrapper
    Version:  SVN                                |           Resolution:        
          
   Keywords:  orm aggregation group by           |                Stage:  
Unreviewed      
  Has_patch:  0                                  |           Needs_docs:  0     
          
Needs_tests:  0                                  |   Needs_better_patch:  0     
          
-------------------------------------------------+--------------------------
Changes (by [EMAIL PROTECTED]):

  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 I would add that the resulting structure should be accessible within a
 template.  Thus, one should be able to have in one's view
 
 context = { [[BR]]
   'stats': model.objects.aggregate(group_by=('field0',), sum=('field1',
 'field2')),[[BR]]
   'items': model.objects.all(),[[BR]]
 }[[BR]]
 return render_to_response('template.html', context)[[BR]]
 
 one should be able to refer to the results in a template as
 
 {{ stats.sum.field1 }}[[BR]]
 {{ stats.group_by.field0 }}
 
 just as one can refer to
 
 {% for item in items %}[[BR]]
 {{ item.field3 }}[[BR]]
 {% endif %}[[BR]]
 
 -tkc

-- 
Ticket URL: <http://code.djangoproject.com/ticket/3566#comment:1>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to