Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I guess correctly from the signature of your view function (<code>def about_page(request, page_id = None):</code>), you likely have another URL configuration that points to the same view but that does not take a <code>page_id</code> parameter. If so, the django reverse function will see only one of these, and it's probably seeing the one without the named <code>page_id</code> regex pattern. This is a pretty common gotcha with reverse! :-)</p> <p>To get around this, assign a name to each of the url patterns (see <a href="http://docs.djangoproject.com/en/dev/topics/http/urls/#syntax-of-the-urlpatterns-variable" rel="noreferrer">Syntax of the urlpatterns variable</a>). In the case of your example, you'd do:</p> <pre><code>(r'^about/(?P&lt;page_id&gt;([a-z]+/)?)$', 'faros.lantern.views.about_page', {}, 'about_with_page_id') </code></pre> <p>and then in the template:</p> <pre><code>&lt;a href="{% url about_with_page_id page_id="contact" %}"&gt;Contact&lt;/a&gt; </code></pre> <hr> <p><strong>Edit</strong></p> <p>Thanks for posting the updated urls.py. In the <code>url</code> template tag, using the unqualified pattern name should do the trick (note that I'm deleting the <code>lantern.views</code> part:</p> <pre><code>&lt;a href="{% url about_page_index %}"&gt;Contact&lt;/a&gt; &lt;a href="{% url about_page page_id="contact" %}"&gt;Contact&lt;/a&gt; </code></pre> <hr> <p><strong>Edit2</strong></p> <p>I'm sorry I didn't twig to this earlier. Your pattern is expressed in a way that django can't reverse, and this is what causes the mismatch. Instead of:</p> <pre><code>r'^about/(?P&lt;page_id&gt;([a-z]+/)?)$' </code></pre> <p>use:</p> <pre><code>r'^about/(?P&lt;page_id&gt;[a-z0-9]+)/$' </code></pre> <p>I created a dummy project on my system that matched yours, reproduced the error, and inserted this correction to success. If this doesn't solve your problem, I'm going to eat my hat! :-)</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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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