From 48be7e96d9968510f2afaf51c4a97c74bea5076e Mon Sep 17 00:00:00 2001 From: pi3c Date: Wed, 11 Oct 2023 17:16:29 +0300 Subject: [PATCH 1/3] gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index fad6f04..48033ec 100755 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ +# тестовые файлы исключаем pyproger/upload/* +!pyproger/upload/.gitkeep + config.ini data/ From eb5eb7938322b24f63805a08ae484fb187cad619 Mon Sep 17 00:00:00 2001 From: pi3c Date: Wed, 11 Oct 2023 17:50:41 +0300 Subject: [PATCH 2/3] gitignore --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 48033ec..95fce45 100755 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # тестовые файлы исключаем -pyproger/upload/* -!pyproger/upload/.gitkeep +pyproger/uploads/* +!pyproger/uploads/.gitkeep config.ini data/ From 9301f984c3109420ab4902b57d1d650d88e8f7be Mon Sep 17 00:00:00 2001 From: pi3c Date: Wed, 11 Oct 2023 19:25:48 +0300 Subject: [PATCH 3/3] =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D1=83=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D0=B7=D0=B0=D0=BC=D0=B5=D1=82=D0=B8=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproger/blog/urls.py | 4 +++- pyproger/config.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproger/blog/urls.py b/pyproger/blog/urls.py index 8efa336..d7a8ace 100644 --- a/pyproger/blog/urls.py +++ b/pyproger/blog/urls.py @@ -91,10 +91,12 @@ def get_posts_by_tag(page=1, tag=None): per_page = current_app.config.get("POSTS_ON_PAGE") posts, total = get_all_posts_by_tag(tag, page, per_page) - total_pages = total // per_page + [0, 1][total % per_page != 0] if posts is None: abort(404) + + total_pages = total // per_page + [0, 1][total % per_page != 0] + list_pages = [ x for x in range(1, total_pages + 1) if x >= page - 2 and x <= page + 2 ] diff --git a/pyproger/config.py b/pyproger/config.py index fa139dc..c163d22 100755 --- a/pyproger/config.py +++ b/pyproger/config.py @@ -1,7 +1,7 @@ import os # Настройки блога -MYLIPOSTS_ON_PAGE = 6 +POSTS_ON_PAGE = 6 # Тема оформления админ панели FLASK_ADMIN_SWATCH = "slate"