I am trying to add a field to the user profile and need to confirm that the user is staff and active but i cannot figure out a command that will display this.
thanks
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With