Changes between Version 1 and Version 2 of Ticket #24570


Ignore:
Timestamp:
Apr 2, 2015, 1:15:04 PM (10 years ago)
Author:
user0007
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #24570 – Description

    v1 v2  
    66    truncate_date = connection.ops.date_trunc_sql('day', 'created_at')
    77
    8     qs = MyModel.objects.filter(user_id=1).annotate(max_date=models.Max('created_at')).extra({'created_at': truncate_date}).values('product_id','created_at','max_date')
     8    qs = MyModel.objects.filter(
     9        user_id=1
     10    ).annotate(
     11        max_date=models.Max('created_at')
     12    ).extra(
     13        {'created_at': truncate_date}
     14    ).values(
     15        'product_id', 'created_at', 'max_date'
     16    )
    917    qs.query.group_by = ['product_id', truncate_date]
    1018    qs.order_by('-max_date')[:10]
     19
    1120}}}
    1221
Back to Top