How to remove super admin from dropdown if user is login

I have to remove the super user from form showing in frontend. Means when I am creating todo and I also choosing user, so super admin is also display in dropdwn so I didn't try anything because i dont know how to do it and i am using built user model

Please help me.

I have to remove the super user from form showing in frontend. Means when I am creating todo and I also choosing user, so super admin is also display in dropdwn so I didn't try anything because i dont know how to do it and i am using built user model

In your views instead of Users.objects.all() try adding a filter:

Users.objects..filter(is_superuser=False)

This question is similar to Django: Filter users by user role.

if user is super user selected then return

return queryset.filter(is_superuser=False)

Back to Top