12👍
You can adapt:
from django.contrib.auth.models import User
active_staff = User.objects.filter(is_active=True, is_staff=True)
You could add in a username=
or similar and if you get an empty result, then you know they don’t match the criteria. For info on what’s in the default model, see django.contrib.auth.
Source:stackexchange.com