[Answered ]-How to get access to a different object through a variable storing Django Max object?

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

Leave a comment