I am beginner in Django and developing a user registration page using the UserCreationForm from django.contrib.auth.forms. But, unable to set the initial values for password1 and password2 fields.
My requirement is when opening the usercreation form the password and re-enter password fields should get filled with an default password.
I have tried this way but unable to achieve this requirement.
views/user.py
if request.method == "POST":
form = UserCreationForm(request.POST)
if form.is_valid():
user = form.save()
else:
form = UserCreationForm(initial={'password1':'testing123','password2':'testing123'})
Any help would be appreciated.