Django how to write query for get current logged in user email?

I have abstract user model. I am using this queryset for getting current logged in user username.

currentuser_username = UserManagement.objects.filter(username=request.user)

my terminal result:

enter image description here

I am not understanding how to write queryset for get current user email. If I don’t know the username of current user then I can write this queryset currentuser_username = UserManagement.objects.filter(username=request.user) and it will give me the username of current user. How to apply same method for getting mail for current user???

here my models.py

class UserManagement(AbstractUser):
      is_blog_author = models.BooleanField(default=False)
      is_editor = models.BooleanField(default=False)
      is_subscriber = models.BooleanField(default=False)
      is_customer = models.BooleanField(default=False)

if you are using django’s default abstract class then request.user is already an instance of the user, did you try request.user.email?

1 Like