I'd like to override Django's administrative "Change Password" page (change_password.html). As such, I've placed Django's "/contrib/admin/templates/registration/password_change_form.html" in my project's "/templates/admin/registration/password_change_form.html" directory. Unfortunately, this doesn't seem to do the trick.
At this point, I'm stumped. I'm guessing it has something to do with Django's /contrib/auth/urls.py file (which directs the the admin change password call to "django.contrib.auth.views.password_change"), but admin template changes have been trivial so far and I'm surprised this one doesn't follow suit.
Any thoughts?
You must use:
templates/registration/password_change_form.html
If you still see the Django's Admin template, you must change the order of your INSTALLED_APPS
(e.g if your template is inside some app, this app must appear before django.contrib.admin
in INSTALLED_APPS
)
https://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.views.password_change
A quick look at the source indicates you should place the template in:
/templates/registration/password_change_form.html
Note bene: there is no 'admin/' in there.
I had the same problem; I believe it has to do how django template loaders work.
If you are using something like
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
With something like TEMPLATE_DIRS = ( os.path.join(PROJECT_DIR, 'templates'), )
Then you would expect that (where localstore is the name of your local satchmo overrides) localstore/templates/registration/password_change_form.html would work. However, it doesn't for the password_change_form because the admin is overwriting it. So, it goes something like:
So, the solution for me was to move my registration template overrides from my localstore/templates directory to the /templates directory of the project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With