исправил пагинацию на главной, центрирование футера, ссылки со взаимодействием
parent
21a818d71e
commit
6af1d3c7cb
|
@ -1,5 +1,4 @@
|
|||
from flask_admin import Admin
|
||||
from flask_ckeditor import CKEditor
|
||||
|
||||
admin = Admin(
|
||||
name="Админ панель",
|
||||
|
|
|
@ -29,10 +29,10 @@ def index(page=1):
|
|||
session["back_url"] = request.url
|
||||
per_page = current_app.config.get("POSTS_ON_PAGE")
|
||||
|
||||
posts, total_pages = get_paginated_posts(page, per_page)
|
||||
list_pages = [
|
||||
x for x in range(1, total_pages + 1) if x >= page - 2 and x <= page + 2
|
||||
]
|
||||
posts, total = get_paginated_posts(page, per_page)
|
||||
total_pages = total // per_page + [0, 1][total % per_page != 0]
|
||||
|
||||
list_pages = [x for x in range(1, total_pages + 1)]
|
||||
return render_template(
|
||||
"blog/index.html",
|
||||
title=f'{current_app.config.get("BRAND")} - разговоры про питон',
|
||||
|
|
|
@ -38,12 +38,10 @@ def get_all_posts_by_tag(tag, page, per_page):
|
|||
.order_by(Post.create_datetime.desc())
|
||||
.paginate(page=page, per_page=per_page, error_out=True)
|
||||
)
|
||||
total_pages = (
|
||||
posts_query.total // per_page + [0, 1][posts_query.total % per_page != 0]
|
||||
)
|
||||
if posts_query.total == 0:
|
||||
return None, None
|
||||
return posts_query, total_pages
|
||||
return None, False
|
||||
print(posts_query.total)
|
||||
return posts_query, posts_query.total
|
||||
|
||||
|
||||
def get_page(slug):
|
||||
|
|
|
@ -8,5 +8,6 @@
|
|||
{% block tail %}
|
||||
{{ super() }}
|
||||
{{ ckeditor.load() }}
|
||||
{{ ckeditor.config(name='text')}}
|
||||
{{ ckeditor.config(name='title', serve_local=True, pkg_type='basic')}}
|
||||
{{ ckeditor.config(name='description', serve_local=True, pkg_type='basic')}}
|
||||
{% endblock %}
|
||||
|
|
|
@ -36,17 +36,17 @@
|
|||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="text-body navbar-nav me-auto mb-2 mb-lg-0 p-3">
|
||||
<li>
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white"
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white p-2 link-body-emphasis link-offset-2 link-underline-opacity-25 link-underline-opacity-75-hover"
|
||||
href="{{ url_for('bp_blog.index')}}">Главная
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white"
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white p-2 link-body-emphasis link-offset-2 link-underline-opacity-25 link-underline-opacity-75-hover"
|
||||
href="{{ url_for('bp_blog.get_all_tags')}}">Статьи по темам</a>
|
||||
</li>
|
||||
{% for m in menu_items %}
|
||||
<li>
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white"
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white p-2 link-body-emphasis link-offset-2 link-underline-opacity-25 link-underline-opacity-75-hover"
|
||||
href="/{{m.slug}}">{{m.name}}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
@ -78,27 +78,27 @@
|
|||
<!-- Section: Social media -->
|
||||
|
||||
<!-- Section: Links -->
|
||||
<section class="">
|
||||
<section class="container-fluid justify-content-center">
|
||||
<!--Grid row-->
|
||||
<div class="row">
|
||||
<!--Grid column-->
|
||||
<div class="col-lg-3 col-md-6 mb-4 mb-md-0">
|
||||
<div class="col-lg-6 col-md-6 mb-4 mb-md-0">
|
||||
<h5 class="text-white">{{ menu_title }}.ru</h5>
|
||||
|
||||
<ul class="list-unstyled mb-0">
|
||||
<li>
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white"
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white link-body-emphasis link-offset-2 link-underline-opacity-25 link-underline-opacity-75-hover"
|
||||
href="{{ url_for('bp_blog.index')}}">Главная
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white"
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white link-body-emphasis link-offset-2 link-underline-opacity-25 link-underline-opacity-75-hover"
|
||||
href="{{ url_for('bp_blog.get_all_tags')}}">Статьи по темам</a>
|
||||
</li>
|
||||
|
||||
{% for m in menu_items %}
|
||||
<li>
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white"
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white link-body-emphasis link-offset-2 link-underline-opacity-25 link-underline-opacity-75-hover"
|
||||
href="/{{m.slug}}">{{m.name}}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
@ -107,24 +107,24 @@
|
|||
<!--Grid column-->
|
||||
|
||||
<!--Grid column-->
|
||||
<div class="col-lg-3 col-md-6 mb-4 mb-md-0">
|
||||
<div class="col-lg-6 col-md-6 mb-4 mb-md-0">
|
||||
<h5 class="text-white">Вебхостинг</h5>
|
||||
|
||||
<ul class="list-unstyled mb-0">
|
||||
<li>
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white"
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white link-body-emphasis link-offset-2 link-underline-opacity-25 link-underline-opacity-75-hover"
|
||||
href="https://www.reg.ru/?rlink=reflink-11750021">Российский регистратор reg.ru </a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white"
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white link-body-emphasis link-offset-2 link-underline-opacity-25 link-underline-opacity-75-hover"
|
||||
href="https://www.reg.ru/domain/new/?rlink=reflink-11750021">Регистрация доменов</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white"
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white link-body-emphasis link-offset-2 link-underline-opacity-25 link-underline-opacity-75-hover"
|
||||
href="https://www.reg.ru/hosting/?rlink=reflink-11750021">Веб хостинг сайтов</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white"
|
||||
<a class="link-offset-2 link-underline link-underline-opacity-0 text-white link-body-emphasis link-offset-2 link-underline-opacity-25 link-underline-opacity-75-hover"
|
||||
href="https://www.reg.ru/vps/cloud/?rlink=reflink-11750021">Облачные серверы</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="conteiner p-4 px-lg-5">
|
||||
<div class="container p-4 px-lg-5">
|
||||
<h4>{{ post.Post.title | safe }}</h4>
|
||||
{{ post.Post.text | safe }}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue