PyScript and Django: Basic PyScript Frontend and DOM manipulations | PyScript tutorial

  Рет қаралды 5,743

Red Eyed Coder Club

Red Eyed Coder Club

Күн бұрын

Пікірлер: 22
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
What video should I make next? Any suggestions? Follow me @: Telegram: t.me/red_eyed_coder_club Twitter: twitter.com/CoderEyed Facebook: fb.me/redeyedcoderclub Timecodes: 00:00 - Demo and description of the Pyscript Django project, attaching Python module to HTML template. 01:09 - Description of the basic Django project. 02:21 - Adding PyScript to Django project as a static file 03:40 - Basic example of DOM manipulations with PyScript (Pyscript onclick event handler and event listener). 06:20 - Sending GET requests with PyScript, using of pyfetch() to send requests to Django (frontend, PyScript side) 13:24 - Accepting a GET request from PyScript (backend, Django side) 15:04 - Checking a request's headers to determine AJAX request 16:15 - Sending POST request with PyScript to Django (frontend, PyScript side) 20:32 - Accepting a POST request from PyScript on Django side 23:02 - Using CSRF token with Pyscript 24:33 - Passing CSRF token with headers to Django 24:49 - Refactoring of header's definition
@j1351209
@j1351209 2 жыл бұрын
pyscript + fastapi
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
@@j1351209 Got it! Thanks for your suggestion!
@pranav8618
@pranav8618 2 жыл бұрын
can u make complete tutorial about pyscript how to manipulate dom and submit data using pyscript
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
@@pranav8618 of course I will continue!
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
@@pranav8618 some examples of DOM manipulations you want to see will be appreciated.
@abrikosa717
@abrikosa717 2 жыл бұрын
Very interesting! Thank you!
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
Thanks for watching!
@hidalgodonquijote6955
@hidalgodonquijote6955 2 жыл бұрын
Олег, спасибо за познавательный туториал. Планируете ли вернуться на свой русскоязычный канал?
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
Спасибо. Если будут работать VISA и MasterCard с иностранными банками, то да, я вернусь.
@shivamrohilla208
@shivamrohilla208 2 жыл бұрын
Can we submit the forms and add validations in the form through pyscript ?
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
Of course! We can submit forms the same way we do it with JQuery or Vue.js. Do you want a video about it?
@shivamrohilla208
@shivamrohilla208 2 жыл бұрын
@@RedEyedCoderClub yes why not 😇, please make these type of videos I mean real videos, so we can use them in our real projects ❤️
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
Ok, got it! But probably it won't be soon
@shivamrohilla208
@shivamrohilla208 2 жыл бұрын
@@RedEyedCoderClub I’ll wait
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
Ok, wrote your suggestion down
@najmulsharifworld
@najmulsharifworld 3 ай бұрын
hi boss , how to import the document under the function ? def on_click(e): ul = document.getElementById('left') ul.innerHTML = 'Hello world'
@felix30ua
@felix30ua 2 жыл бұрын
у тебя там f-string, тогда f"I got: {number:.1f}", без float 😉
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
Верно! Я так сделал для очевидности и наглядности. Не нужно было ничего объяснять лишний раз, т.к. и так затянул видос.
@CabraBRGamer
@CabraBRGamer 2 жыл бұрын
First off all, thank you so much for this very interesting post. My code before response = await make_request(... is not running and I dont know how to fix it. Any help would be wellcome. Tks async def submit_form(e): msg = document.querySelector('#msg') city_input = document.querySelector('#cityInput') city = city_input.value body = json.dumps({'name': city}) response = await make_request(url='/', method='POST', body=body) msg.innerHTML = response if response.get('errors'): city_input.classList.add('is-invalid') else: city_input.classList = 'form-control is-valid' p = document.createElement('p') p.innerHTML = 'Criado elemento ' + response['name'] ul = document.getElementById('cities') li = document.createElement('li') li.innerHTML = response['name'] ul.appendChild(li)
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
What doesn't mean not running? What errors shows you Python? And what errors shows you Javascrtipt? You can find the output in Inspector > Console tab
@CabraBRGamer
@CabraBRGamer 2 жыл бұрын
@@RedEyedCoderClub tks for read. No error shown! Simply lines after await make_request() seems to be ignored. Putting This aside, rest of the codé Works fine. For insntance, city is written on city.models and so on 🤔
Nastya and balloon challenge
00:23
Nastya
Рет қаралды 66 МЛН
Officer Rabbit is so bad. He made Luffy deaf. #funny #supersiblings #comedy
00:18
Funny superhero siblings
Рет қаралды 8 МЛН
小丑妹妹插队被妈妈教训!#小丑#路飞#家庭#搞笑
00:12
家庭搞笑日记
Рет қаралды 38 МЛН
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 81 М.
Django AJAX Tutorial: Basic AJAX in Django app with Fetch API | Django casts
19:27
PyScript - Run Python in the Browser! THE END of JavaScript???
8:21
Patrick Loeber
Рет қаралды 367 М.
PyScript is officially here!🚀 Build web apps with Python & HTML
17:10
Full Stack Developers will take over. This is why.
11:26
Ed Andersen
Рет қаралды 48 М.
What’s Up with Laravel? It’s Everywhere, and Here’s Why!
6:22
Django & HTMX - Dynamic Form Creation and Submission
24:36
BugBytes
Рет қаралды 29 М.
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
pixegami
Рет қаралды 274 М.
Nastya and balloon challenge
00:23
Nastya
Рет қаралды 66 МЛН