I am trying to display the password in the Admin backend table in the following way, containing the algorithm, iterations, salt and hash:
However, my current page looks like the following:
As you can see it is just the hashed password, not displaying any of the information unlike the above. Can anyone see where I am going wrong?
Please find my code below:
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from hobbies.models import extendedUser, User, Hobby
from .forms import LoginForm, SignUpForm
from django.forms import ModelForm
from django.contrib.auth.forms import ReadOnlyPasswordHashField
#admin.site.register(User,UserAdmin)
class CustomUserAdmin(UserAdmin):
add_form = SignUpForm
form = LoginForm
model = extendedUser
readonly_fields = ["password"]
list_display = ('email', 'is_staff', 'is_active',)
list_filter = ('email', 'is_staff', 'is_active',)
fieldsets = (
(None, {'fields': ('email', 'password', 'city')}),
('Permissions', {'fields': ('is_staff', 'is_active')}),
)
add_fieldsets = (
(None, {
'classes': ('wide',),
'fields': ('email', 'password', 'is_staff', 'is_active')}
),
)
search_fields = ('email',)
ordering = ('email',)
admin.site.register(User, CustomUserAdmin)
Thank you for your time, Alex
I think they use display using this function:
get_session_auth_hash() which is a part of the base abstract user in django.contrib.auth.base_user