When you're changing password, you're using a function, that's most probably in your application's views.py file. When that function is at the end, it's most probably going to return some data, and it most often returns it to the template.
Here's an example:
return render_to_response('myapplication/frontend.html', {'profile': profile_obj},
context_instance=RequestContext(request))
In this case, it's going to return the value of variable profile_obj
to the template frontend.html
, which is probably in /myproject/myapp/templates/myapp/frontpage.html
. After that, you can access that object's instances by invoking {{ profile.instance }}
from within your template file.
More about this function can be found here.
Now, urls.py
file is the file that's used for forwarding requests to desired application.
Example:
url(r'^accounts/chpasswd/?',
'django.contrib.auth.views.password_change',
{'template_name':'password_change.html'}),
url(r'^accounts/chpasswd/done/?',
'django.contrib.auth.views.password_change',
{'template_name':'password_change_done.html'}),
And this means following(given your website is at www.mysite.com):
When a one opens www.mysite.com/accounts/chpasswd/
, run function password_change
from a view of django.contrib.auth
module, and if that function is fruitful(returns a value of some kind), let it return a value to a template called password_change.html
django.contrib.auth module is used for stuff like that: logging in and out, password functions and so.
Now, you should be aware of 2 things:
1) your templates must be in a place where django will be looking for them, so check TEMPLATE_DIRS
setting in settings.py.
2) I believe(but am not 100% sure) that Django already has such a template, predefined. In case you have the same template name as one of Django's default templates, make sure that your app comes before django.contrib.admin
in INSTALLED_APPS
, or else you'll be shown a django template(shares the same design as django admin).
===================================
EDIT since question was edited, too
Try changing order in urls.py, like so:
url(r'^accounts/chpasswd/done/?',
'django.contrib.auth.views.password_change_done',
{'template_name':'password_change_done.html'}),
url(r'^accounts/chpasswd/?',
'django.contrib.auth.views.password_change',
{'template_name':'password_change.html'}),