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

21
app.py
View File

@ -66,18 +66,25 @@ def page_posts_from_db():
return render_template("interactive-posts.html", postos=postos) return render_template("interactive-posts.html", postos=postos)
@app.route('/post_my_post', methods=['POST']) @app.route('/post_my_post/<post_key>', methods=['POST'])
def post_a_post(): def post_a_post(post_key):
postos = db.collection('posts') postos = db.collection('posts')
novenkiy = {
'texto': 'next post is this',
}
#### TODO проверить как-то по-умному что мы таки его добавили #### 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') postos = db.collection('posts')
return render_template("i-posts.html", postos=postos) return render_template("i-posts.html", postos=postos)

View File

@ -25,7 +25,7 @@
</div> </div>
<div class="col s12"> <div class="col s12">
<div class="card-action right"> <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> </div>
</div> </div>