Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django ORM Basic ORM Usage Take Control

Derrick Kearney
Derrick Kearney
2,962 Points

Changes to course_nav and course_extras cause an error

NoReverseMatch at /courses/ Reverse for 'detail' with arguments '()' and keyword arguments '{'pk': ''}' not found. 1 pattern(s) tried: ['courses/(?P<pk>\d+)/$']

course_extras

@register.inclusion_tag('courses/course_nav.html')
def nav_courses_list():
    courses = Course.objects.filter(published=True).values()[:5]
    return {'courses': courses}

course_nav

{% for course in courses %}
    <li><a href="{% url 'courses:detail' pk=course.id %}">{{ course.title }}</a></li>
{% endfor %}
Heidi Ulrich
Heidi Ulrich
4,624 Points

I think your function should return more than only your arguments.

Derrick Kearney
Derrick Kearney
2,962 Points

Thanks @Heidi, my brain is elsewhere today, and this was 5 months ago. I am going to retake the course from scratch.