How to allow the admin to change the uses's password in the Django admin panel?

I want to allow the admin to change any user's pasword, but th admin panel doesn't have that option anymore.My admin panel

I had to extend the abstract user class to add some fields to my users when they are created. I wanted to know what I can do to allow my admin users to change the user's passowrds.

This is my User class:

from django.db import models
from django.contrib.auth.models import AbstractUser

# Create your models here.
class User(AbstractUser):
    numero_de_empleado= models.CharField(max_length=100, unique=True,   default="0", verbose_name="Puente")



    class Meta:
        permissions = [
            ("view_retiro", "Ver retiro"),
            ("make_changes","Crear dotaciones y arqueos"),
            ("create_user","Crear un usuario"),
            ("view_all","Ver toda la información")
        ]

And this is my admin.py from my user app:

from django.contrib import admin
from .models import User
# Register your models here.
admin.site.register(User)

I am not an expert in django and i don't lnow why it's doing this, Thanks in advance.

This can definitely be done in Django Admin non-programmatically:

  1. Log into Django admin with the admin or superuser account.
  2. Click on Users (or accounts depending on what you named your accounts app).
  3. That should display the table showing registered users in your app. Click on the user you want to change the password.
  4. Click on the Reset password button. enter image description here
  5. Enter a new password for the user enter image description here
  6. Confirm Password and click the Change Password button.

You should see the message "Password changed successfully" which confirms you've successfully changed password for the user.

Вернуться на верх