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.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0fefeee4-530f-6097-ad2b-594dfbf1dd9d%40dewhirst.com.au.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to