41 lines
1.3 KiB
HTML
41 lines
1.3 KiB
HTML
{%extends 'base.html'%}
|
|
{%load static%}
|
|
{%block extracss%}
|
|
<link rel="stylesheet" href="{% static 'Community/css/list_posts.css' %}">
|
|
{%endblock extracss%}
|
|
{%block content%}
|
|
<div class="post_list">
|
|
<h2>Posts</h2>
|
|
{% if user.is_authenticated %}
|
|
<a href="{%url 'add_post'%}" id="add_post">Add new post</a>
|
|
{%endif%}
|
|
{% for post in page_obj %}
|
|
<div class="post_details">
|
|
<a href="{%url 'post-details' pk=post.id %}">
|
|
<h3 class="title">{{ post.title }}</h3>
|
|
<div class="date_author">
|
|
<p class="date">{{post.date_pub}}</p>
|
|
<p class="author">{{post.author.username}}</p>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
{% endfor %}
|
|
<div class="pagination">
|
|
<span class="step-links">
|
|
{% if page_obj.has_previous %}
|
|
<a href="?page=1">« first</a>
|
|
<a href="?page={{ page_obj.previous_page_number }}">previous</a>
|
|
{% endif %}
|
|
|
|
<span class="current">
|
|
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}.
|
|
</span>
|
|
|
|
{% if page_obj.has_next %}
|
|
<a href="?page={{ page_obj.next_page_number }}">next</a>
|
|
<a href="?page={{ page_obj.paginator.num_pages }}">last »</a>
|
|
{% endif %}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
{%endblock content%} |