Changes between Initial Version and Version 1 of Ticket #29527, comment 1


Ignore:
Timestamp:
Jun 27, 2018, 4:44:45 PM (6 years ago)
Author:
Ryan Hiebert

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29527, comment 1

    initial v1  
    99
    1010def after(queryset, value):
    11     fields = ['a', 'b', 'c', 'id']
    1211    return (
    1312        queryset
    14         .annotate(rank=Func(*(F(field) for field in fields), function='ROW'))
    15         .filter(rank=Subquery(queryset.filter(id=value).values(*fields)))
    16         .order_by(*fields)
     13        .annotate(rank=Func(F('a'), F('b'), F('c'), F('id'), function='ROW'))
     14        .filter(rank__gt=Subquery(queryset.filter(id=value).values('a', 'b', 'c', 'id')))
     15        .order_by('a', 'b', 'c', 'id')
    1716    )
    1817}}}
Back to Top