This commit is contained in:
2017-12-08 02:18:43 +03:00
parent 721f258297
commit 54bc697308
4 changed files with 10 additions and 10 deletions

View File

@ -1,5 +1,5 @@
{% load staticfiles %} {% load staticfiles %}
{% load pagination_filters %} {% comment %} {% load pagination_filters %} {% comment %}
<html> <html>
<head> <head>
<title>BLOG</title> <title>BLOG</title>
@ -64,7 +64,7 @@
{% if posts.has_other_pages %} {% if posts.has_other_pages %}
<a href="?page=1{% if search_query != '' %}&search={{ search_query }} {% endif %}"></a> <a href="?page=1{% if search_query != '' %}&search={{ search_query }} {% endif %}"></a>
{% for page in posts.paginator.num_pages|truncate:posts.number %} {% for page in posts.paginator.num_pages|truncate:posts.number %}
{% if page == posts.number %} {{page}} {% if page == posts.number %} {{page}}
{% else %} <a href="?page={{page}}{% if search_query != '' %}&search={{ search_query }} {% endif %}">{{page}}</a> {% endif %} {% endfor %} {% else %} <a href="?page={{page}}{% if search_query != '' %}&search={{ search_query }} {% endif %}">{{page}}</a> {% endif %} {% endfor %}
<a href="?page={{ posts.paginator.num_pages }}{% if search_query != '' %}&search={{ search_query }} {% endif %}"></a> <a href="?page={{ posts.paginator.num_pages }}{% if search_query != '' %}&search={{ search_query }} {% endif %}"></a>
{% endif %} {% endif %}
@ -73,7 +73,7 @@
{% if posts.has_previous %} {% if posts.has_previous %}
<li> <a href="?page=1"><<</a> </li> <li> <a href="?page=1"><<</a> </li>
<li> <a href="?page={{ posts.previous_page_number }}">{{ posts.previous_page_number }}</a> </li> <li> <a href="?page={{ posts.previous_page_number }}">{{ posts.previous_page_number }}</a> </li>
{% endif %} {% endif %}
{% if posts.has_other_pages %}<li> <a style="color: #000000" href="">{{ posts.number }}</a></li> {% endif %} {% if posts.has_other_pages %}<li> <a style="color: #000000" href="">{{ posts.number }}</a></li> {% endif %}
{% if posts.has_next %} {% if posts.has_next %}
<li> <a href="?page={{ posts.next_page_number }}"> {{ posts.next_page_number }}</a> </li> <li> <a href="?page={{ posts.next_page_number }}"> {{ posts.next_page_number }}</a> </li>

View File

@ -1,5 +1,5 @@
{% extends 'blog/base.html' %} {% extends 'blog/base.html' %}
{% load pagination_tags %} {% comment %} {% load pagination_tags %} {% endcomment %}
{% block content %} {% block content %}
{% if posts %} {% if posts %}
@ -8,7 +8,7 @@
<div class="post-header"> <div class="post-header">
<h2><a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a></h2> <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> <div class="date"><i class="fa fa-calendar"></i> {{ post.published_date}}</div>
{% if post.tags.names %} {% if post.tags.names %}
<div class="tag"> <div class="tag">
<i class="fa fa-tags"></i> <i class="fa fa-tags"></i>
{% for tag in post.tags.names %} {% for tag in post.tags.names %}
@ -17,10 +17,10 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
{{ post.text|safe|linebreaksbr|truncatewords:80 }} <!--|linebreaksbr|truncatewords:80 }}</p--><br> {{ post.text|safe|linebreaksbr|truncatewords:80 }} <!--|linebreaksbr|truncatewords:80 }}</p--><br>
</div> </div>
{% endfor %} {% endfor %}
{% else %} {% else %}
<div class="post"> <div class="post">
<p>Ничего не найдено</p> <p>Ничего не найдено</p>

View File

@ -41,7 +41,7 @@ INSTALLED_APPS = [
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'blog', 'blog',
'taggit', 'taggit',
'pagination', # 'pagination',
] ]
MIDDLEWARE_CLASSES = [ MIDDLEWARE_CLASSES = [

View File

@ -1,5 +1,5 @@
Django==1.11 Django==1.11.1
django-taggit==0.22.1 django-taggit==0.22.1
psycopg2 psycopg2
django-tinymce django-tinymce