This is a very simple project built with PyScript and Django.
Django on the backend side, and Pyscript as the frontend.
The main idea of the video is to show how to submit form with PyScript to Django, how to send AJAX POST-requests with PyScript, and how to validate submitted data with Django ModelForm.
When I'm clicking on the green button Pyscript sends a POST request to my Django application, and Django validate a user's input, and creates a City object, then it sends the object back to PyScript.
Follow me @:
Telegram: https://t.me/red_eyed_coder_club
Twitter: / codereyed
Facebook: https://fb.me/redeyedcoderclub
=== 📎 The source code is available via Patreon ===
https://red-eyed-coder-club.github.io...
Timecodes:
00:00 - Beginning, the task, and the demo.
01:04 - Basic Django project description.
03:18 - Adding PyScript to Django project as a static file
04:16 - Explanation of a PyScript submitting form process.
04:35 - Adding PyScript event handler, and listener to the submit button.
06:20 - submit_form() as an event handler (send AJAX request with PyScript, and render a response from Django).
09:49 - make_request() to send AJAX POST-request to Django.
13:24 - Rendering Django response in submit_form().
15:24 - Django side beginning.
15:53 - Creating a Django Model.
16:56 - Creating a Django form (FormModel) for Django City model to validate users' input.
17:50 - Creating a custom Django validator.
19:21 - Using of Django Form to validate users' input.
** Other Django Tutorials **
Django Forms: • Python Django Tutorial #7: Django For...
Django ModelForms: • Python Django Tutorial #8: Django Mod...
PyScript and Django: How to submit form and validate on Django side | PyScript tutorial:
• PyScript and Django: How to submit fo...
#pyscript #django #redeyedcoderclub