46👍
✅
is_superuser
is a flag on the User model, as you can see in the documentation here:
So to get the superusers, you would do:
from django.contrib.auth.models import User
superusers = User.objects.filter(is_superuser=True)
And if you directly want to get their emails, you could do:
superusers_emails = User.objects.filter(is_superuser=True).values_list('email')
Source:stackexchange.com