1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | {% block related %}
<div id="related-posts"><h2>{% trans "Related posts" %}</h2>
{% for tag in object.get_tags %}
{% tagged_objects tag in blog.Post as relatedItems %}
{% if relatedItems|length_is:"0" %}
{% else %}
<h3>{{ tag }}</h3>
<ul>
{% for relatedItem in relatedItems|slice:":3" %}
<li><a href="{{ relatedItem.get_absolute_url }}">{{ relatedItem.name|typogrify }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
</div>
{% endblock %}
|
More like this
- django-tagging clouds template tag by skam 5 years, 2 months ago
- TaggedManager and TaggedQuerySet with chainable tagged() methods implemented with django-tagging by fish2000 2 years, 3 months ago
- Parse TemplateTag Variables Safely by evan_schulz 3 years, 10 months ago
- paginator using url tag by fivethreeo 4 years, 9 months ago
- Paginator TemplateTag by trbs 4 years, 1 month ago
Comments