Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango NoReverseMatch error
    primarykey
    data
    text
    <p>I am new to Django and have started working on a mature Django project.</p> <p>I want to add a new page to the user account screens, and link to it. But I am getting a NoReverseMatch error.</p> <p>To /users/urls.py I added:</p> <pre><code>url(r'^panel/history$', 'theproject.users.views.history', name='account_history' ), </code></pre> <p>...which is consistent with the line above it:</p> <pre><code>url(r'^panel$', 'theproject.users.views.control_panel', name='account_panel' ), </code></pre> <p>To /users/views.py I added:</p> <pre><code>@login_required def history(request): return render_to_response('users/ourbrand_history.html', {}, context_instance=RequestContext(request)) </code></pre> <p>...which is consistent with the line above it:</p> <pre><code>@login_required def control_panel(request): return render_to_response('users/ourbrand_panel.html', {}, context_instance=RequestContext(request)) </code></pre> <p>To /templates/users/ourbrand_panel.html I added:</p> <pre><code>&lt;a href="{% url account_history %}"&gt;History&lt;/a&gt; </code></pre> <p>...which is consistent with the line above it:</p> <pre><code>&lt;a href="{% url account_panel %}"&gt;Home&lt;/a&gt; </code></pre> <p>Now when I load /panel I get a TemplateSyntaxError: NoReverseMatch.</p> <pre><code>Reverse for 'account_history' with arguments '()' and keyword arguments '{}' not found. </code></pre> <p>UPDATE: As a test, I removed my link in the template -- and /panel loads fine. If I then delete /users/urls.py and /users/views.py /panel still loads. I have deleted all cookies, history etc. Do I have to run a command at the terminal (like rake in ruby) to commit changes to urls.py? Or should changes 'just work'? </p>
    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.
 

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