Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This somewhat confusing <code>'('',)'</code> meant that the <code>url</code> argument list consisted of a single empty string, as if the template was <code>{% url ben:forum '' %}</code>. Without your view code it is impossible to know how it happened.</p> <p>&nbsp;</p> <p>Now that you posted all your views, we still do not know which one is causing the error :) What we do know, though, is that <strong>none of them</strong> pass a <code>forum_pk</code> context variable to <code>render_to_response</code>.</p> <p>&nbsp;</p> <p>Is it <code>post</code>? You need to figure out the forum pk and pass it to your template:</p> <pre><code> def post(request, ptype, pk): """Display a post form.""" action = reverse("ben:%s" % ptype, args=[pk]) if ptype == "new_thread": title = "Start New Topic" subject = '' forum_pk = pk elif ptype == "reply": title = "Reply" thread = Thread.objects.get(pk=pk) forum_pk = thread.forum.pk subject = "Re: " + thread.title return render_to_response("forum/post.html", add_csrf(request, subject=subject, action=action, title=title, forum_pk=forum_pk)) </code></pre> <p>I don't approve of this <code>post</code> view design, where <code>pk</code> means different things depending on <code>ptype</code>. Nevertheless, if <code>ptype</code> is <code>new_thread</code>, we already have <code>forum_pk</code> as <code>pk</code>. If it's <code>reply</code>, we need to get the <code>Thread</code> by <code>pk</code>, and get the thread's forum's <code>pk</code> as <code>forum_pk</code>.</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.
 

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