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

course.step_set.all origins

In the Python Django Basics course, the templating for course_detail.html makes use of the loop:

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

Where does the step_set come from? I do not recall explicitly defining that anywhere during the course and a search doesn't yield anything attaching it to an explicit class (although I am not certain how to search for such a thing).

The Step Class contains the line

course = models.ForeignKey(Course)

Is this the connection between course and step that makes course.step_all work? If that is the case, how is it understood that *_all is a function?

Is it the case that Django makes assumptions about what it is being used for,

Further, is the .all() (parenthesis suppressed) the built-in .all()?