diff --git a/app.py b/app.py index 430d2b3..58b3e46 100644 --- a/app.py +++ b/app.py @@ -66,9 +66,20 @@ def page_posts_from_db(): return render_template("interactive-posts.html", postos=postos) -# @app.route('/post_my_post', method=['POST']) -# def post_a_post(): -# pass +@app.route('/post_my_post', method=['POST']) +def post_a_post(): + + + postos = db.collection('posts') + novenkiy = { + 'texto': 'next post is this', + } + + #### TODO проверить как-то по-умному что мы таки его добавили + metadata = postos.insert(novenkiy, overwrite_mode='update') + + return render_template("i-posts.html", postos=[novenkiy]) + # @app.route('/post_my_file', method=['POST']) # def post_a_file(): diff --git a/templates/i-posts.html b/templates/i-posts.html index a3d97c8..6295461 100644 --- a/templates/i-posts.html +++ b/templates/i-posts.html @@ -1,38 +1,36 @@ {% if postos | length > 0 %} {% for posto in postos %} -
-
- {% if posto.root_post %} -
- {% else %} -
- {% endif %} -
-
-
-
-
- - - -
-
+
+ {% if posto.root_post %} +
+ {% else %} +
+ {% endif %} +
+
+
+
+ -
-
-
- #{{ posto._key }} -

{{ posto.texto }}

-
-
-
- -
-
+
+
-
-
+
+
+ #{{ posto._key }} +

{{ posto.texto }}

+
+
+
+ +
+
+
+
{% endfor %} {% endif %} \ No newline at end of file diff --git a/templates/interactive-posts.html b/templates/interactive-posts.html index ac12c1b..643dbb8 100644 --- a/templates/interactive-posts.html +++ b/templates/interactive-posts.html @@ -9,6 +9,9 @@ -{% include 'i-posts.html' %} +
+ {% include 'i-posts.html' %} +
+ {% endblock content %} \ No newline at end of file diff --git a/templates/main-page.html b/templates/main-page.html index c7acc60..8a620f1 100644 --- a/templates/main-page.html +++ b/templates/main-page.html @@ -13,10 +13,7 @@
- -
- - +