Running into an error in Ch.9


It looks like it might have to be with the way my edit_question is written:

In template /Users/radhigulati/projects/interviewflows/collection/templates/questions/questions_detail.html, error at line 9
Reverse for ‘edit_question’ with arguments ‘()’ and keyword arguments ‘{‘slug’: ‘’}’ not found. 1 pattern(s) tried: [‘questions/(?P[-\w]+)/edit/$’]


Looks like you have a URL generated in your template with an empty slug ({'slug': ''}).

If that doesn’t help, put the code for your url/view/template into and I’ll try to see if I can see the error. :)


All in pastebin! Let me know if there is anything else you need :) Thanks!!


So in questions_detail, you have a piece of code that requires the question and slug to be passed in:

<a href="{% url 'edit_question' slug=question.slug %}">

However, in your view, you’re not passing along the question:

def question_detail(request, slug):
    # grab the object
    question = Questions.objects.get(slug=slug)
    # and pass to the template
    return render(request, 'questions/questions_detail.html', {

So I believe your error is the template being all “ack! I have no question.slug!”

Try passing in the question into the template and see if that fixes things. :)


Oh wow I totally missed that. I don’t think I would have been able to figure that out on my own. Thank you sooooo much!!!