From da998af86302bf6d26a36d2cf58e59a272942b90 Mon Sep 17 00:00:00 2001 From: Simple_Not <44047940+moonbaseDelta@users.noreply.github.com> Date: Mon, 3 Jul 2023 23:45:49 +1000 Subject: [PATCH] some structure --- app.py | 5 ++++- templates/board.html | 15 ++++++++++++-- templates/main-page.html | 2 +- threads_with_posts.py | 45 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 threads_with_posts.py diff --git a/app.py b/app.py index f89689d..ddf2def 100644 --- a/app.py +++ b/app.py @@ -3,6 +3,7 @@ from flask_assets import Bundle, Environment from todo import todos from boards import board_list from threads import threads_lists +from threads_with_posts import open_threads import socket @@ -43,7 +44,9 @@ def homepage(): ### stolen @app.route("/boards/") def page_board(board_id): - return render_template("board.html", board_id=board_id, boards=board_list, board_threads=threads_lists[board_id]) + + b_threads = [ open_threads[thread_id] for thread_id in open_threads if thread_id in threads_lists[board_id]] + return render_template("board.html", board_id=board_id, boards=board_list, board_threads=b_threads) ### stolen diff --git a/templates/board.html b/templates/board.html index ceef1cf..fd2b8b8 100644 --- a/templates/board.html +++ b/templates/board.html @@ -24,13 +24,24 @@ - + + + + + {% for thread in board_threads %} - + + + + + + {% endfor %} diff --git a/templates/main-page.html b/templates/main-page.html index 939f03c..8652f0a 100644 --- a/templates/main-page.html +++ b/templates/main-page.html @@ -22,7 +22,7 @@ - + {% endblock content %} diff --git a/threads_with_posts.py b/threads_with_posts.py new file mode 100644 index 0000000..d38969d --- /dev/null +++ b/threads_with_posts.py @@ -0,0 +1,45 @@ +# : {, , , } +open_threads = { + '123': { + 'thread_num': '123', + 'post_num': '9999', + 'pic_link': '16216445863900.jpg', + 'txt': 'фыва', + 'name': 'anonius' + }, + '124': { + 'thread_num': '124', + 'post_num': '456', + 'pic_link': '16672846165910.png', + 'txt': 'Test', + 'name': 'anonius' + }, + '1': { + 'thread_num': '123', + 'post_num': '1', + 'pic_link': '16211265989190.jpg', + 'txt': 'фыва', + 'name': 'anonius' + }, + '44': { + 'thread_num': '44', + 'post_num': '12', + 'pic_link': '15937598937440.png', + 'txt': 'I hate my brother-nation..', + 'name': 'Владимир Владимирович' + }, + '99': { + 'thread_num': '99', + 'post_num': '55', + 'pic_link': 'Экран-смерти.jpg', + 'txt': 'фыва', + 'name': 'anonius' + }, + '1230': { + 'thread_num': '1230', + 'post_num': '1234', + 'pic_link': '15906018690140.png', + 'txt': '33333!', + 'name': 'SIRNA' + } +} \ No newline at end of file
{{thread}}{{thread.thread_num}}{{thread.post_num}}{{thread.name}} + + {{thread.txt}}