Adding Extra Fields On Many-To-Many Relationships in Django

  Рет қаралды 42,749

Pretty Printed

Pretty Printed

Күн бұрын

If you want to be able to add more information to your many-to-many relationships in Django, this video will show you how to do it.
Need one-on-one help with your project? I can help through my coaching program. Learn more here: prettyprinted.com/coaching
Get the code here: prettyprinted.com/l/TeF
Join my free course on working with the database and models in Django: prettyprinted.com/djangodata
Twitter: / pretty_printed
Github: github.com/prettyprinted

Пікірлер: 65
@prettyprinted
@prettyprinted 4 жыл бұрын
Join my free course on working with the database and models in Django: prettyprinted.com/djangodata
@shahnwazhusain9967
@shahnwazhusain9967 4 жыл бұрын
Sir can you please make a video on deployment of django app on Azure?
@pramodmc1921
@pramodmc1921 2 жыл бұрын
Hi Anthony, How can I do this with Flask and Flask-SQLAlchemy
@rushas
@rushas 4 жыл бұрын
Great content! Finally a video with the right pace, relevant information and without tons of pause sounds ("umm...", "so...") Good job man. Looking forward for this kinda stuff
@serageibraheem2386
@serageibraheem2386 Жыл бұрын
Dude you solved three problems in a single video. Thanks
@wenbinyang1689
@wenbinyang1689 2 жыл бұрын
Excellent. Exactly what I'm looking for. Thanks for the effort.
@codedjango
@codedjango 4 жыл бұрын
Wow...I never used a 3rd model till now....definitely going to try this....Thank you
@armankamal3694
@armankamal3694 3 жыл бұрын
Seriously you explained it so well. Thank you
@benonemarcos4720
@benonemarcos4720 4 жыл бұрын
Excelent. Thanks for that. I was looking for something like this to solve a problem in my code.
@rangabharath4253
@rangabharath4253 4 жыл бұрын
Awesome as always
@thombou40
@thombou40 3 жыл бұрын
When working with a model form, how to handle the additional fields in the table defined by the though argument? I display the many-to-many relationship with checkboxs and for each option I'd like to be able to set the additional fields value (a quantity field)
@thedasilvakid
@thedasilvakid Жыл бұрын
Really helpful! Thank you!
@ProjectXH
@ProjectXH Жыл бұрын
Thank you for this video, you are a gent!
@vikashkumarbarnwal4233
@vikashkumarbarnwal4233 Жыл бұрын
Mind blowing ! It gave me exactly what I need. thank You !
@evouae
@evouae 3 жыл бұрын
Exactly what i was looking for. Very well explained. Thanks. Do you have a full course ?
@vaneakatok
@vaneakatok 3 жыл бұрын
I believe so. Chek his site
@Ezeiur
@Ezeiur 2 жыл бұрын
thanks! this help me a lot
@sinarasoulihaghighi998
@sinarasoulihaghighi998 Жыл бұрын
this video helped me a lot
@EricSouzarys
@EricSouzarys 4 жыл бұрын
Hey Anthony! How would you make the authentication of a project that have both Rest API and Web pages? For example, let's suppose that there is an API for getting data that should be plotted in some graph, but this will be used both in an Android app and in a page rendered by the Flask, but to access the dashboard it's needed to be logged
@Georgeggg82
@Georgeggg82 3 жыл бұрын
Hi Anthony thank you for this, it’s really well explained. One question. How do I query all the students enrolled for a particular course before a specific date?
@jinwooje9672
@jinwooje9672 4 жыл бұрын
Thank you very much for the great tutorial! I have one question. Instead of putting in the 'through=enrollment' argument in courses, is it okay to add it in students?
@thedupy124
@thedupy124 2 жыл бұрын
Amazing tutorial !
@erickvasquezballon6406
@erickvasquezballon6406 4 жыл бұрын
Clear and helpfull, for beginers
@julio23my
@julio23my 4 жыл бұрын
excelent video i like how your explain this stuff
@bobbye.5431
@bobbye.5431 4 жыл бұрын
Nice video ! Thx Anthony I think the "create" method does automatically the "save" for you ;)
@ar_sky_blue
@ar_sky_blue 3 жыл бұрын
Thank you very much . I finally found a great video 10/10
@ruzzan
@ruzzan 4 жыл бұрын
Hey man love your vids!! Can you make a video on your thoughts on django 3 and asynchronous features? Can it be as node async???
@ABMA79
@ABMA79 3 жыл бұрын
an amazing explanation. thanks a lot. but is it possible how to display data on web if you have a many to many relation? if you have a course explaining that, it will be great... Thanks for the wonderful lesson.
@taihatranduc8613
@taihatranduc8613 3 жыл бұрын
It's very good. Thank you
@monetized1
@monetized1 11 ай бұрын
Thank you, this was the best
@prettyprinted
@prettyprinted 11 ай бұрын
Glad you liked it. Thanks for watching!
@user-xu7jz4li7e
@user-xu7jz4li7e 3 ай бұрын
@@prettyprinted Can you please do a video on how to create a form using the many-to-many through model? Thank you!
@mnogokotin
@mnogokotin Жыл бұрын
thx for the video )
@muteebakram37
@muteebakram37 3 жыл бұрын
Hi, Good content mate. One question: I know django creates a default id as primarykey in manytomany table. I want to have a custom primary key to the manytomany table. How to do it?
@tochimclaren
@tochimclaren 4 жыл бұрын
Good tutorial thanks. By the way I have a question I want to ask regarding forms how is the dynamic form on django-quiz achieved. Where questions come after one another with options. For the answer. Thanks.
@matiascoco99
@matiascoco99 3 жыл бұрын
I suppose Ajax could make what you ask. Simply POST data from a field, make a function that check that field constantly so you don't have to put a button to POST data. It's better with a GET request rather than POST, but the idea it's the same
@Kruiger1993
@Kruiger1993 2 жыл бұрын
Great Video! just wondering why did you have to comment the two table of Student, Course in order to create Enrollment?
@lixanderguzman3305
@lixanderguzman3305 3 жыл бұрын
using the through argument, how do I render say student name to templates?
@aniketkumbhar9246
@aniketkumbhar9246 4 жыл бұрын
Thabks man!
@aniketkumbhar9246
@aniketkumbhar9246 4 жыл бұрын
*Thanks
@ankitdubey9256
@ankitdubey9256 2 жыл бұрын
hey, is there any way to add more than two columns of same class model to another model having many to many relationship. Eg, let say we have a Employee model which contains a recursive relationship with a column say manager, and we want a table named Dispute which is having manyToManyField with these two columns. How this can be done?
@dodokwak
@dodokwak 4 жыл бұрын
Thanks.
@fcomosan
@fcomosan 3 жыл бұрын
in minute 8, when I run migrate, I got an error: ValueError: Cannot alter field erp.Group.teams into erp.Group.teams - they are not compatible types (you cannot alter to or from M2M fields, or add or remove throu gh= on M2M fields) In my case, I'm working with Team and Group models. Thanks
@saikatdatta94
@saikatdatta94 3 жыл бұрын
Getting the same error
@saharamanson1970
@saharamanson1970 4 жыл бұрын
Nice bro
@IMADETHISACCFORRAY
@IMADETHISACCFORRAY 3 жыл бұрын
Hey, Any clue why we can't display the M2M-field as its normally displayed in the admin area? Gotta use the tabular or stackinline which is kind of annoying.
@jpongthep
@jpongthep 2 жыл бұрын
I get thia problem too. Can you solve the problem?
@halilibrahimsoyman5797
@halilibrahimsoyman5797 Жыл бұрын
I have a complex project and ı dont wan to drop tables. Is there any way for this?
@amolgode9843
@amolgode9843 2 жыл бұрын
Hello Sir...! I have two models A and B which having many to many relation and form third model E with extra attributes . so i want to perform following sql query using django : select * from A , B , E where A.id = E.id and B.id = E.id and A.id = '107'; how i can do..? A.objects().filter(e__aid=107) geves me only content from A model. Plzz Help..!
@rimacrsp9932
@rimacrsp9932 Жыл бұрын
We can use through to customise many to many relationship in django
@azherali5
@azherali5 3 жыл бұрын
i am not getting table when click on show table, could you please help
@tylerwatson3318
@tylerwatson3318 3 жыл бұрын
How would I select the variable "final_grade" through the ORM? i.e. "anthony.course_set.first().final_grade" --does not work. Any suggestions?
@RuslanSkiraUkraine
@RuslanSkiraUkraine 3 жыл бұрын
anthony.enrollment_set.values('final_grade') docs.djangoproject.com/en/3.0/ref/models/querysets/#values
@tylerwatson3318
@tylerwatson3318 3 жыл бұрын
@@RuslanSkiraUkraine Thank you. that helped!
@be_pie_today
@be_pie_today 10 ай бұрын
when you already have data you do not want to delete the whole model :) wolud be nice to mention how to migrate from m2m to separate table
@7s9n
@7s9n 3 жыл бұрын
💛💛💛💛
@kaustubhsawant9653
@kaustubhsawant9653 2 жыл бұрын
How to add existing field of a model to a new model
@khadimhusen
@khadimhusen 2 жыл бұрын
I think this is redundant work. As we are already defining three model. Then what is the advantage of manytomany field.
@omaral-halabiah2851
@omaral-halabiah2851 2 жыл бұрын
print('like '*100)
@patrickolsen473
@patrickolsen473 Жыл бұрын
For anyone playing around with the through-relationship, think long and hard about it. You can't easily change it once you've made the migration. it comes with an error, even if you uncomment all your models, that says "Cannot alter field xxx.xxx.xxx into yyy.yyy.yyy they are not compatible types (you cannot alter to or from M2M fields, or add or remove through= on M2M fields)". I still haven't found a solution although I am not alone on the internet to have experienced this fault
How to Create Custom Commands in Django
25:50
Pretty Printed
Рет қаралды 11 М.
Зачем он туда залез?
00:25
Vlad Samokatchik
Рет қаралды 2,9 МЛН
New model rc bird unboxing and testing
00:10
Ruhul Shorts
Рет қаралды 23 МЛН
Русалка
01:00
История одного вокалиста
Рет қаралды 7 МЛН
Best father #shorts by Secret Vlog
00:18
Secret Vlog
Рет қаралды 22 МЛН
Understanding Django Model Relationships
25:56
Pretty Printed
Рет қаралды 94 М.
A Simple Many-To-Many Example in Django
12:36
Chuck Severance
Рет қаралды 14 М.
Getting Started With Django REST Framework
26:31
Pretty Printed
Рет қаралды 199 М.
How to Write Complicated Queries in Django With F Expressions
10:44
Pretty Printed
Рет қаралды 16 М.
How to Use the Related Name Attribute in Django
10:56
Pretty Printed
Рет қаралды 23 М.
Showing a Craigslist scammer who's boss using Python
5:27
Engineer Man
Рет қаралды 6 МЛН
How to Use Select Related and Prefetch Related in Django
9:34
Pretty Printed
Рет қаралды 26 М.
Зачем он туда залез?
00:25
Vlad Samokatchik
Рет қаралды 2,9 МЛН