django_blog/blog/templates/blog/post_list.html

31 lines
837 B
HTML
Raw Normal View History

2017-10-29 13:40:42 +03:00
{% extends 'blog/base.html' %}
{% load pagination_tags %}
2017-11-08 12:43:13 +03:00
{% block content %}
2017-11-09 17:34:42 +03:00
{% if posts %}
2017-11-08 12:43:13 +03:00
{% for post in posts %}
2017-11-05 01:54:32 +03:00
<div class="post">
<div class="post-header">
<h2><a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a></h2>
<div class="date"><i class="fa fa-calendar"></i> {{ post.published_date}}</div>
2017-11-08 12:43:13 +03:00
{% if post.tags.names %}
<div class="tag">
<i class="fa fa-tags"></i>
{% for tag in post.tags.names %}
2017-11-09 17:34:42 +03:00
<a href="{% url 'post_list' tag=tag%}">{{ tag }}</a>
2017-11-05 01:54:32 +03:00
{% endfor %}
2017-11-08 12:43:13 +03:00
</div>
{% endif %}
</div>
{{ post.text|safe|linebreaksbr|truncatewords:80 }} <!--|linebreaksbr|truncatewords:80 }}</p--><br>
</div>
{% endfor %}
2017-11-09 17:34:42 +03:00
{% else %}
<div class="post">
<p>Ничего не найдено</p>
2017-11-08 12:43:13 +03:00
</div>
2017-11-09 17:34:42 +03:00
{% endif %}
2017-10-29 13:40:42 +03:00
{% endblock content %}