[Fixed]-Django querying models

1๐Ÿ‘

โœ…

If I understood you correctly, this may do it

TrafficData.objects\
           .filter(business_id__in=competitors)\
           .annotate(max_date=Max('date'))\
           .order_by('-max_date')\
           .values('business_id', 'visits', 'max_date')
๐Ÿ‘คC14L

Leave a comment