1👍
✅
You can obtain the Bids
with the largest bid
with .latest(…)
[Django-doc]:
winning_bid = Bids.objects.latest('bid')
winner = winning_bid.user
You can boost efficiency with .select_related(…)
[Django-doc] to load the user details in the same query:
winning_bid = Bids.objects.select_related('user').latest('bid')
winner = winning_bid.user
Source:stackexchange.com