Django Admin Not Hashing Custom User Password

django, python-3.x

Solution

I guess the problem is that you inherited ModelAdmin instead of UserAdmin from django.contrib.auth.admin in your admin.py.

Sample code:

from django.contrib.auth.admin import UserAdmin
from .models import Employee

class EmployeeAdmin(UserAdmin):
    pass

admin.site.register(Employee, EmployeeAdmin)

Problem

- Python 3 - Django 1.5 - PostgreSQL 5.0.3 I'm new to Django & I'm making a Django app that makes use of AbstractUser, but when I create a user in the Django admin, and then look at the user's info in the admin, I see the password in plain text. Checking directly in the DB, I see the password is definitely being stored as plaintext. I'm trying to write some views to do some authentication, but it's not working even when the username and password are correct. So I'm guessing that the `authenticate()` function is hashing but returns `None` since the password is not actually hashed. Is there any possible reason why the password isn't getting hashed? I'd post some code, but I don't think any code will help, since my model doesn't include any code that does anything with the password field (that's generated & done by Django). If there is something I'm doing or not doing, I wouldn't even know what part of the code it would be in so I'd have to post everything from my settings, models, admin, etc.

Original source