Я пытаюсь вывести на экран имя User
.
Вот мой views.py
:
bid = Bid.objects.filter(listing_offer_id=itemID).order_by("bid_offer").values()
last_bid = bid.last()# the last value of sorted list of bids
bid_offer = last_bid["bid_offer"] # gets the max value of bid offers
bid_owner = User.objects.filter(id = last_bid['bid_owner_id'])# gets the owner of the bid
Вот модель Bid
:
class Bid(models.Model):
bid_offer = models.IntegerField()
listing_offer = models.ForeignKey(Listing, on_delete = models.CASCADE, related_name = "listings", null = True)
bid_owner= models.ForeignKey(User, on_delete = models.CASCADE)
вот модель Listing
:
class Listing(models.Model):
title = models.CharField(max_length= 64)
description = models.CharField(max_length= 128)
img = models.ImageField(upload_to = 'auctions/media/images')
isActive = models.BooleanField(default= True)
owner = models.ForeignKey(User, on_delete = models.CASCADE, related_name="user")
categories = models.ForeignKey(Category, on_delete = models.CASCADE, blank= True, null = True, related_name = "category", default = "None")
price = models.IntegerField(default = 0)
модель User
это AbstractUser
Как вывести просто ismail
без скобок и т.д?