Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>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.</p> <p>Here's an example:</p> <pre><code>return render_to_response('myapplication/frontend.html', {'profile': profile_obj}, context_instance=RequestContext(request)) </code></pre> <p>In this case, it's going to return the value of variable <code>profile_obj</code> to the template <code>frontend.html</code>, which is probably in <code>/myproject/myapp/templates/myapp/frontpage.html</code>. After that, you can access that object's instances by invoking <code>{{ profile.instance }}</code> from within your template file.</p> <p>More about this function <a href="https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render-to-response" rel="nofollow" title="can be found here">can be found here</a>.</p> <p>Now, <code>urls.py</code> file is the file that's used for forwarding requests to desired application. Example:</p> <pre><code>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'}), </code></pre> <p>And this means following(given your website is at www.mysite.com):</p> <p>When a one opens <code>www.mysite.com/accounts/chpasswd/</code>, run function <code>password_change</code> from a view of <code>django.contrib.auth</code> module, and if that function is fruitful(returns a value of some kind), let it return a value to a template called <code>password_change.html</code> </p> <p>django.contrib.auth module is used for stuff like that: logging in and out, password functions and so. </p> <p>Now, you should be aware of 2 things:</p> <p>1) your templates must be in a place where django will be looking for them, so check <code>TEMPLATE_DIRS</code> setting in settings.py.</p> <p>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 <code>django.contrib.admin</code> in <code>INSTALLED_APPS</code>, or else you'll be shown a django template(shares the same design as django admin).</p> <p>===================================</p> <h1>EDIT since question was edited, too</h1> <p>Try changing order in urls.py, like so:</p> <pre><code>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'}), </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload