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


Ignore:
Timestamp:
Feb 22, 2015, 9:26:45 PM (10 years ago)
Author:
Raphael Gaschignard

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #24386, comment 2

    initial v1  
    44
    55{{{
    6 In [5]: Employee.objects.annotate(Sum('owner__employee__number')).values()
    7 Out[5]: [{'status': u'not_active', 'number': 3, u'id': 2, 'owner__employee__number__sum': 7, 'start_date': datetime.date(2015, 2, 23), u'owner_id': 1}, {'status': u'active', 'number': 4, u'id': 1, 'owner__employee__number__sum': 7, 'start_date': datetime.date(2015, 2, 23), u'owner_id': 1}]
     6In [8]: Employee.objects.annotate(Min('owner__employee__number')).values()
     7Out[8]: [{'status': u'not_active', 'number': 3, u'id': 2, 'owner__employee__number__min': 3, 'start_date': datetime.date(2015, 2, 23), u'owner_id': 1}, {'status': u'active', 'number': 4, u'id': 1, 'owner__employee__number__min': 3, 'start_date': datetime.date(2015, 2, 23), u'owner_id': 1}]
    88
    9 In [6]: Employee.objects.filter(number=4).annotate(Sum('owner__employee__number')).values()
    10 Out[6]: [{'status': u'active', 'number': 4, u'id': 1, 'owner__employee__number__sum': 7, 'start_date': datetime.date(2015, 2, 23), u'owner_id': 1}]
     9In [9]: Employee.objects.filter(number=4).annotate(Min('owner__employee__number')).values()
     10Out[9]: [{'status': u'active', 'number': 4, u'id': 1, 'owner__employee__number__min': 3, 'start_date': datetime.date(2015, 2, 23), u'owner_id': 1}]
    1111}}}
Back to Top