[Fixed]-Django: NoReverseMatch at /courses/2/

0πŸ‘

βœ…

In the line

    <a href=" {% url 'courses:step' course_pk=step.course.pk step_pk=step_pk %} ">

Here step_pk = step_pk is not working. Step_pk is not defined because you did not return any information about step_pk in def course_detail at this line:

      return render(request, "courses/course_detail.html", {"course": course})

pass step inside return and use step_pk = step.pk

Please check it. Thanks.

1πŸ‘

you need

{% url 'courses:step' course_pk=step.course.pk step_pk=step.pk %}

step.pk instead of step_pk which doesnot exist in your context

πŸ‘€doniyor

Leave a comment