-1

I'm creating a control panel where the superuser can view a table of all users along with their info. I want to add the users passwords to a column, and a link to an edit form to change the password.

C. Red.
  • 47
  • 5

1 Answers1

0

let say you have list_passwords view where you send super user can view passwords

from django.views.decorators.http import require_http_methods

@require_http_methods(['GET'])
def list_password(request):
    if not request.user.is_superuser:
        # return with error
    else:
        # return data 

Another view to update password

@require_http_methods(['PATCH'])
def update_password(request):
   if not request.user.is_superuser:
       # return with error
   else:
       # update user password 
navyad
  • 3,752
  • 7
  • 47
  • 88