Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- Начало блока с отдельным постом -->
- <div class="card mb-3 mt-1 shadow-sm">
- {% load thumbnail %}
- {% thumbnail post.image "960x339" crop="center" upscale=True as im %}
- <img class="card-img" src="{{ im.url }}">
- {% endthumbnail %}
- <div class="card-body">
- <p class="card-text">
- <!-- Ссылка на страницу автора в атрибуте href; username автора в тексте ссылки -->
- <a href="{% url 'profile' username=post.author %}"><strong class="d-block text-gray-dark">{{ post.author }}</strong></a>
- <!-- Текст поста -->
- {{ post.text|linebreaksbr}}
- </p>
- <!-- Если пост относится к какому-нибудь сообществу, то отобразим ссылку на него через # -->
- {% if post.group %}
- <a class="card-link muted" href="{% url 'group_url' post.group.slug %}">
- <strong class="d-block text-gray-dark">#{{ post.group.title }}</strong>
- </a>
- {% endif %}
- <div class="d-flex justify-content-between align-items-center">
- <div class="btn-group ">
- <!-- Ссылка на страницу записи в атрибуте href-->
- <a class="btn btn-sm text-muted" href="{% url 'post_single' username=post.author post_id=post.pk %}" role="button">
- {% if post.post_comments.exists %}
- {{ post.post_comments.count }} комментариев
- {% else%}
- Добавить комментарий
- {% endif %}
- </a>
- <!-- Ссылка на редактирование, показывается только автору записи -->
- {% if user.is_authenticated and user.username == post.author.username %}
- <a class="btn btn-sm text-muted" href="{% url 'post_edit' username=post.author post_id=post.pk %}" role="button">Редактировать</a>
- {% endif %}
- </div>
- <!-- Дата публикации -->
- <small class="text-muted">{{ post.pub_date }}</small>
- </div>
- </div>
- </div>
- <!-- Конец блока с отдельным постом -->
Advertisement
Add Comment
Please, Sign In to add comment