check posts
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simple_Not 2023-07-13 21:56:36 +10:00
parent 1173482a57
commit 4024f8f032
2 changed files with 15 additions and 8 deletions

19
app.py
View File

@ -66,17 +66,24 @@ def page_posts_from_db():
return render_template("interactive-posts.html", postos=postos)
@app.route('/post_my_post', methods=['POST'])
def post_a_post():
@app.route('/post_my_post/<post_key>', methods=['POST'])
def post_a_post(post_key):
postos = db.collection('posts')
novenkiy = {
'texto': 'next post is this',
}
#### TODO проверить как-то по-умному что мы таки его добавили
metadata = postos.insert(novenkiy, overwrite_mode='update')
metadata = postos.insert({
'texto': 'next post is this',
}, overwrite_mode='update')
db.collection('posts').insert({
'_key': post_key,
'_from': f'posts/post_key',
'_to': f'posts/{metadata["_key"]}'
}, overwrite_mode='update')
postos = db.collection('posts')
return render_template("i-posts.html", postos=postos)

View File

@ -25,7 +25,7 @@
</div>
<div class="col s12">
<div class="card-action right">
<a href="#" hx-post="/post_my_post" hx-target="#neu-posts" >Answer me!</a>
<a href="#" hx-post="/post_my_post/{{ posto._key }}" hx-target="#neu-posts" >Answer me!</a>
</div>
</div>
</div>