django check user admin

First, import the necessary module with the following code:

from django.contrib.auth.models import User

Next, use the following code to check if the user is an admin:

user = User.objects.get(username='username')
is_admin = user.is_staff

Finally, use the boolean variable is_admin to determine if the user is an admin.