Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Django Basics Django Templates Add a Detail View

Gilang Ilhami
Gilang Ilhami
12,045 Points

Nothin appeared during the {% for step in course.step_set.all %} loop

While the course's title and descriptions appeared, the step title and descriptions in the for loop did not appear.

{% extends "layout.html" %}

{% block title %}{{ course.title }}{% endblock title %}

{% block content %}
  <h2>{{ course.title }}</h2>
  {{ course.description }}

    {% for step in course.step_set.all %}
      <h3>{{ step.title }}</h3>
      {{ step.description }}
    {% endfor %}
{% endblock content %}

2 Answers

Kenneth is great teacher but if you really want to know whats happening under the hood then go trough official Django tutorial for begginers

link: https://docs.djangoproject.com/en/1.11/intro/tutorial01/

Haydar Al-Rikabi
Haydar Al-Rikabi
5,971 Points

Make sure that the "Step" model in your app's models.py has this foreign key: course = models.ForeignKey(Course)