manytomany object for loop

Nested for loop

Tags

{% for item in tutorials %}

	{% for tag in item.tags.all %}
	{{ tag }}
	{% endfor %}

{% endfor %}    
<h4>4 tutorial -> core.CurriculumItem.None / .all is the key </h4>

  {% for item in curriculum.tutorial.all %}
         {{ item.title }}
            <br>
        {{ item.instructor }}
            <br>
        {{ item.link }}
    {% endfor %}
{% for item in tutorials %}
                            <tr>
                                <td><button class="btn btn-warning search_btn" type="submit"> Add </button></td>
                                <td><a href="{% url 'hub:tutorial_detail' item.pk %}">{{item.title}}</a></td>
                                <td>{{item.instructor}}</td>
                                <td>
                                {% for tag in item.tags.all %}
                                {{ tag }}
                                {% endfor %}
                                </td>
                                <td>{{item.last_updated}}</td>
                                <td>{{item.difficulty}}</td>
                                <td>{{item.language}}</td>
                                <td>{{item.duration}}</td>

좋은 웹페이지 즐겨찾기