Please do not use string comparison to check for user roles. This approach is error prone, may use more memory for new created strings and is dangerous overall. For example if value that represents role is not it's name you will have to keep track of name-value mapping yourself. Or if library will change it's mind and swap names to integers etc.
All libraries that provide such functionality has roles enum lying somewhere with all the values for roles. So, for example, in django-user-roles you can do
user.role.is_super # maybe role.is_Super
# or
from userroles import roles
user.role == roles.super # maybe roles.Super
This is much more readable and safer aproach.
type(request.user.role)<class 'django.contrib.auth.models.Group'>printprints whateverstrreturns, so you might comparestr(request.user.role) == "Super", but there's probably a better way.isto compare two values.user.roleto string and comparing with role name - it's error prone, potentially uses more memory and has plenty other things bad with it. There should be an enum with all the values and comparison should look likeuser.role == roles.superoruser.role.is_superetc.