OvenBakedGoods
OvenBakedGoods

Reputation: 7

Setting up a detail view in Django

I'm new to Django and learning about creating apps and projects. Recently I've set up a view and everything appears to be working but I'm wanting to set up a detailed view for each object. I'm getting the following error

Invalid block tag on line 11: 'endblock', expected 'empty' or 'endfor'. Did you forget to register or load this tag?

{% extends "layout.html" %}
2   {% block title %}{{course.title}}{% endblock %}
3   {% block content %}
4   <article>
5       <h2>{{course.title}}</h2>
6       {{ course.description }}
7       <section>
8           {% for step in course.step_set.all %}
9           <h3>{{ step.title }}</h3>
10          {{ step.description }}
11          {% endblock %}
12      </section>
13  </article>
14  {% endfor %}

Upvotes: 0

Views: 54

Answers (1)

Mr.k1n1
Mr.k1n1

Reputation: 74

{% extends "layout.html" %}
   {% block title %}{{course.title}}{% endblock %}
   {% block content %}
       <article>
          <h2>{{course.title}}</h2>
          {{ course.description }}
           <section>
             {% for step in course.step_set.all %}
              <h3>{{ step.title }}</h3>
              {{ step.description }}
            {% endfor %} 
          </section>
       </article>
{% endblock %}

swap endblock and endfor.

Upvotes: 1

Related Questions