{"id":20836,"date":"2025-02-25T05:32:19","date_gmt":"2025-02-25T10:32:19","guid":{"rendered":"https:\/\/shaarejesed.com\/?page_id=20836"},"modified":"2025-02-25T05:33:04","modified_gmt":"2025-02-25T10:33:04","slug":"feedbacks","status":"publish","type":"page","link":"https:\/\/shaarejesed.com\/en\/feedbacks\/","title":{"rendered":"\u00a1D\u00c9JANOS TU FEEDBACK!"},"content":{"rendered":"\nfrom flask import Flask, render_template, request\nimport sqlite3\n\napp = Flask(__name__)\n\ndef init_db():\n    with sqlite3.connect(&#8220;comments.db&#8221;) as conn:\n        conn.execute(&#8220;CREATE TABLE IF NOT EXISTS comments (id INTEGER PRIMARY KEY AUTOINCREMENT, text TEXT)&#8221;)\n\n@app.route(&#8216;\/&#8217;)\ndef home():\n    return &#8221;&#8217;\n    <!DOCTYPE html>\n    <html>\n    <head>\n        <title>Comentarios An\u00f3nimos<\/title>\n    <\/head>\n    <body>\n        <h2>Deja tu comentario an\u00f3nimo<\/h2>\n        <form action=\"\/submit\" method=\"post\">\n            <textarea name=\"comment\" required><\/textarea>\n            <br>\n            <button type=\"submit\">Enviar<\/button>\n        <\/form>\n    <\/body>\n    <\/html>\n    &#8221;&#8217;\n\n@app.route(&#8216;\/submit&#8217;, methods=[&#8216;POST&#8217;])\ndef submit():\n    comment = request.form.get(&#8220;comment&#8221;)\n    if comment:\n        with sqlite3.connect(&#8220;comments.db&#8221;) as conn:\n            conn.execute(&#8220;INSERT INTO comments (text) VALUES (?)&#8221;, (comment,))\n    return &#8220;Comentario enviado. Gracias!&#8221;\n\n@app.route(&#8216;\/admin&#8217;)\ndef admin():\n    with sqlite3.connect(&#8220;comments.db&#8221;) as conn:\n        comments = conn.execute(&#8220;SELECT * FROM comments&#8221;).fetchall()\n    return render_template(&#8220;admin.html&#8221;, comments=comments)\n\nif __name__ == &#8216;__main__&#8217;:\n    init_db()\n    app.run(debug=True)\n\n","protected":false},"excerpt":{"rendered":"<p>from flask import Flask, render_template, request import sqlite3 app = Flask(__name__) def init_db(): with sqlite3.connect(&#8220;comments.db&#8221;) as conn: conn.execute(&#8220;CREATE TABLE IF NOT EXISTS comments (id INTEGER PRIMARY KEY AUTOINCREMENT, text TEXT)&#8221;) @app.route(&#8216;\/&#8217;) def home(): return &#8221;&#8217; Comentarios An\u00f3nimos Deja tu comentario an\u00f3nimo Enviar &#8221;&#8217; @app.route(&#8216;\/submit&#8217;, methods=[&#8216;POST&#8217;]) def submit(): comment = request.form.get(&#8220;comment&#8221;) if comment: with sqlite3.connect(&#8220;comments.db&#8221;) as conn: conn.execute(&#8220;INSERT INTO comments (text) VALUES (?)&#8221;, (comment,)) return &#8220;Comentario enviado. Gracias!&#8221; @app.route(&#8216;\/admin&#8217;) def admin(): with sqlite3.connect(&#8220;comments.db&#8221;) as conn: comments = conn.execute(&#8220;SELECT * FROM comments&#8221;).fetchall() return render_template(&#8220;admin.html&#8221;, comments=comments) if __name__ == &#8216;__main__&#8217;: init_db() app.run(debug=True)<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-20836","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/shaarejesed.com\/en\/wp-json\/wp\/v2\/pages\/20836","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shaarejesed.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/shaarejesed.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/shaarejesed.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shaarejesed.com\/en\/wp-json\/wp\/v2\/comments?post=20836"}],"version-history":[{"count":2,"href":"https:\/\/shaarejesed.com\/en\/wp-json\/wp\/v2\/pages\/20836\/revisions"}],"predecessor-version":[{"id":20838,"href":"https:\/\/shaarejesed.com\/en\/wp-json\/wp\/v2\/pages\/20836\/revisions\/20838"}],"wp:attachment":[{"href":"https:\/\/shaarejesed.com\/en\/wp-json\/wp\/v2\/media?parent=20836"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}