In this video, we will refactor our Django backend to return JSON data using the django-ninja library, rather than our previous, manual approach to serializing data.
This short video will demonstrate how to set up a simple django-ninja endpoint, that handles serializing a Django QuerySet, based on a schema that we define.
The complete code can be found in the "3 - Alpine and Django Integration" folder on the Github repository: https://github.com/bugbytes-io/django...
📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
01:12 Create api.py file
02:15 Creating django-ninja API route
03:01 Creating ModelSchema for API response
04:19 Adding API urls
05:12 Changing x-init data url
☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
https://ko-fi.com/bugbytes
▶️ Full Playlist:
• Alpine.js
𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📖 Blog: https://www.bugbytes.io/posts/
👾 Github: https://github.com/bugbytes-io/django...
🐦 Twitter: / bugbytesio
📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
django-ninja: https://django-ninja.rest-framework.com/
x-init directive: https://alpinejs.dev/directives/init
#django #alpinejs #python