Django ManyToManyFields and Through-Models for many-to-many relationships

preview_player
Показать описание
In this video, we'll look at many-to-many relations in Django. We'll see how to add a ManyToManyField on a Django model, and how to use that field to query for related objects with the ManyRelatedManger and functions such as add(), remove(), all(), set() and clear().

We'll also look at junction tables in the database, created for many-to-many relationships, and will see how Django creates these implicitly, and how we can explicitly add extra data to these tables via through models.

📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
01:36 ManyToManyField in Django
04:26 Junction Tables for ManyToManyFields in Django
06:27 Querying ManyToManyFields in Django
19:00 Customising ManyToManyFields with the through argument (through models)

☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:

▶️ Full Playlist:

𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:

📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:

#python #django #webdevelopment #database #sql
Рекомендации по теме
Комментарии
Автор

`Deep dive` really suits this course. Every video has at least one new thing to learn

abbasebadian
Автор

Just aww, I really can say that I've well understood the M2M concept with this one 🙌🏾. Thank you mate !

seydinaoumarsamabaly
Автор

Impressive!!! By far, the best video of the ManyToMany relations in Django!!! Thank you very much.

alfredoa
Автор

Thank you. This was the best overview of the manytomany relation options in Django I have seen so far. Perhaps in a next version you can elaborate on the 'related_name' option and how to use that?

treborsol
Автор

Thank you, guy! This is a video that I will watch many times. It has a lot of good information and clear explanations!

Pedro_Nora
Автор

Saving this for the weekend. Thank you!

立法院很忙
Автор

Bruh you saved me so much time in my buiding project. Keep the good work! Awesome

LoumiGueye
Автор

Subscribed right after finishing the video.

sheryarbaloch
Автор

Excellent explanation ! came here to understand M2M queries and achieved that plus so much more ! Off to put into practice now ...

mikedodds
Автор

Man thank you, this video clarified my doubt in M2M in django

krugergaming-yt
Автор

👍 great stuff, very helpful, thanks a lot

neon_symeon
Автор

As usual great content. One thing is in the admin panel if you are using inlines, that the model require the related_name..through as the end as in "model = Restaurant.staff.through" if you want to list all staff members under each restaurant in a stacked or tabular inline. This will also display the through table fields. Pretty nifty.

khunjohn
Автор

This is supper man thanx for creating this series and also other series and videos you have provided that's great content man I have benefited and learnt a lot from you keep up the good work, Thnax once again.

westonmufudza
Автор

Thanks, man! A great video that helped me a lot

aVdnlUBQ
Автор

Thank you so much:). That is a very good tutorial:)

bjdollcoloredpencil
Автор

In your next HTMX x Alpine.js video could you cover passing data between htmx and Alpine components. Eg. How do I change an HTMX request based on x-data state?
I saw the "htmx.process()" method, but It's not so clear.

Keep up the great work
🇿🇦

Septumsempra
Автор

hello, tanks for this course, its so useful for me
please record a course about deep dive in view
and please record a course to customizing admin panel template and add some function to admin panel

ashkanhasani-et
Автор

Hey, great video.
Just one question, at 17:40, can't we just add another `staffs = ManyToManyField(Staff)` in Restaurant model as well?

rakeshmali
Автор

What is the link to the previous video?

HeisenbergHK
Автор

hi in this case we have 2 table and a many to many relationship, what if have 3 table and and a many to many relationship, how can i write many to many field and where ?

killer_hok