On 23/05/2023 10:22 am, Muhammad Juwaini Abdul Rahman wrote:
How can one run Python code from the backend that triggers on the front-end upon clicking a button on a certain page?
Have a close look at htmx.
It doesn't run Python but will replace any targeted HTML element with output from Python (or any other code) running on the backend.
You would otherwise need a Python interpreter running in the browser. But who wants that with all the security issues entailed?
Htmx is a javascript library which enhances HTML itself. Your HTML in your template then calls your Django views directly to replace any part of a page with the result.
If htmx had been around earlier, all those famous js frameworks would never have been needed. It is a life saver.
M
-- Signed email is an absolute defence against phishing. This email has been signed with my private key. If you import my public key you can automatically decrypt my signature and be sure it came from me. Your email software can handle signing.
No comments:
Post a Comment