Understanding Django Model Relationships

Understanding Django Model Relationships

Pretty Printed

5 лет назад

94,245 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Elphas
Elphas - 02.07.2023 10:50

How do you clear the shell?

Ответить
danieluxury
danieluxury - 23.02.2023 06:23

Amazing ♡♡♡ thank you so much

Ответить
Ashley Burgess
Ashley Burgess - 20.02.2023 02:55

so clear and concise

Ответить
Isaac Hatilima
Isaac Hatilima - 24.10.2022 18:08

Hi late to the party. I have a question, say I have 3 models, Country, State or Province and City or Town. Country ID if FK in Province/State. Should I have County and State PK as FK in City or just state FK and when I query a city I would be able to get all city, state and country details? If so, how can that be done?

Thanks.

Ответить
Forbidden Lion
Forbidden Lion - 02.10.2022 23:21

Love you man!

Ответить
Reejohn Stellas
Reejohn Stellas - 10.08.2022 10:19

Thanks bruh

Ответить
Muskan Kaushik
Muskan Kaushik - 23.07.2022 17:08

This is a great tutorial. Thanks a lot!

Ответить
Rabi M
Rabi M - 10.03.2022 09:56

Thank you

Ответить
aditya gupta
aditya gupta - 24.02.2022 14:18

Thank you so much...🥺😇🙏🙏🙏

Ответить
ermal gashi
ermal gashi - 23.02.2022 21:26

I come back to this video from time to time, great content.

Ответить
K.Bharath Reddy
K.Bharath Reddy - 10.02.2022 13:51

can i create an suggest friends notification api using model relationships

Ответить
Successive Vichu
Successive Vichu - 22.01.2022 12:55

Thank you for your clear explanation about models relationship

Ответить
Mohammad Rastad
Mohammad Rastad - 15.09.2021 13:10

That was awesome

Ответить
Yashar Xaspoladov
Yashar Xaspoladov - 12.06.2021 21:51

I thought you can only save without specifying a field by saying commit = false. But here we somehow do it without

Ответить
Indian Software Engineer
Indian Software Engineer - 24.04.2021 17:02

Thanks a lot sir, you nailed it....
love you from India.

Ответить
Deepanshu Aggarwal
Deepanshu Aggarwal - 08.04.2021 12:55

In One-to-one relationship, we are getting only 1 attribute data. what we have to do to get all fields data?

Ответить
Vlad Mikheenko
Vlad Mikheenko - 01.04.2021 16:24

I could feel Corey Chafer intro

Ответить
faisal islam
faisal islam - 14.03.2021 03:08

You explain those so easy way

Ответить
The Software Coder
The Software Coder - 11.03.2021 16:13

Hey Anthony, great explanation and easy to understand, keep going with more stuff! Thanks ;-)

Ответить
sagar gahatraj
sagar gahatraj - 01.03.2021 09:50

Perfect Tutorial 👍thanks alot!!

Ответить
e1nste1in
e1nste1in - 24.02.2021 11:53

Why does the many-to-many table requires its own id? (Thx for the Video! :)

Ответить
Aashay Amballi
Aashay Amballi - 31.01.2021 18:17

Thank you 🙏🏼

Ответить
MAYANK CHAUDHARI
MAYANK CHAUDHARI - 19.01.2021 16:47

This guy is true fan of captain america

Ответить
AmineOnline
AmineOnline - 11.12.2020 13:50

Good explanation

Ответить
Peyman Hassani
Peyman Hassani - 26.11.2020 17:13

thanks for the great video

Ответить
HopWorks Embedded Imagination
HopWorks Embedded Imagination - 24.11.2020 17:03

Great tutorial on Django Model relationships! I read quite a few tutorials on this but did not really get it until I watched your video. THANK YOU! Liked and subscribed. I can't wait to watch the other videos you posted. (Thor for president!) =)

Ответить
Đăng Trần Hải
Đăng Trần Hải - 19.09.2020 21:30

Great, easy to follow. Thanks alot!!

Ответить
Богдан б
Богдан б - 30.07.2020 08:39

Gold!!! Great work

Ответить
Wajahat Ali
Wajahat Ali - 24.07.2020 09:15

Wao superb explanation ✌️

Ответить
Daniel Daniel
Daniel Daniel - 13.07.2020 22:53

About the example "Frameworks and Languages", how can i add a field on Languages and put the quantity of framework have the language?

Ответить
19_18 Dixit Parmar
19_18 Dixit Parmar - 13.07.2020 21:53

Extremely useful, Thank you sooo much 💞

Ответить
krinky krow
krinky krow - 10.07.2020 17:28

Thank you very much. When concluding on one to many relationships you said you'll get into more about it in another video,which one?

Ответить
Michael Santos
Michael Santos - 02.07.2020 11:00

Great tutorial, thanks! could anyone tell me what shell it is he is using btw? looks nice

Ответить
Varun L
Varun L - 30.06.2020 08:52

The best video tutorial ever for django. Awesome explanation . I immediately joined your django tutorial course . Is any GitHub Repository available to refer the code available in this video ?

Ответить
Besta Prem Sai
Besta Prem Sai - 29.06.2020 08:35

hey what is the tool you are using for db visualisation

Ответить
Souliphon_test
Souliphon_test - 25.06.2020 13:04

I have these models:
class BorrowBook(models.Model):
books = models.ManyToManyField(Book)
def __str__(self):
return f'{self.id}'
class CheckOutBorrow(models.Model):
book = models.OneToOneField(BorrowBook, on_delete=models.CASCADE)
point = models.ForeignKey(Point, on_delete=models.CASCADE)
employee = models.ForeignKey(User, on_delete=models.CASCADE)
date_rent = models.DateTimeField(default=timezone.now)
date_return = models.DateField(max_length=8, help_text='YY-MM-DD')
def __str__(self):
return f'ID: {self.id}'
class Point(models.Model):
amount = models.IntegerField()
member = models.OneToOneField(Members, on_delete=models.CASCADE)
def __str__(self):
return f'{self.id}'
I want to filter a model “CheckOutBorrow” in point = ForeignKey
Example:
I want to get a value like this ‘Checkoutborrow.point.amount’ and update the a value in amount.
How can I do that? Please help me

Ответить
Souliphon_test
Souliphon_test - 25.06.2020 13:03

I have these models:
class BorrowBook(models.Model):
books = models.ManyToManyField(Book)
def __str__(self):
return f'{self.id}'
class CheckOutBorrow(models.Model):
book = models.OneToOneField(BorrowBook, on_delete=models.CASCADE)
point = models.ForeignKey(Point, on_delete=models.CASCADE)
employee = models.ForeignKey(User, on_delete=models.CASCADE)
date_rent = models.DateTimeField(default=timezone.now)
date_return = models.DateField(max_length=8, help_text='YY-MM-DD')
def __str__(self):
return f'ID: {self.id}'
class Point(models.Model):
amount = models.IntegerField()
member = models.OneToOneField(Members, on_delete=models.CASCADE)
def __str__(self):
return f'{self.id}'
I want to filter a model “CheckOutBorrow” in point = ForeignKey
Example:
I want to get a value like this ‘Checkoutborrow.point.amount’ and update the a value in amount by subtracting it auto.
How can I do that? Please help me!

Ответить
Bektursun Samat uulu
Bektursun Samat uulu - 14.06.2020 17:22

Comment, like, subscribe, and the bell. Thank you very much for all your hard work. Appreciate it, man.

Ответить
Supriyo Chowdhury
Supriyo Chowdhury - 10.06.2020 11:10

First of all a big love from India ❤️. This is a awesome tutorial. I never thought I will get that kind of professional knowledge for free. I also join your free class. I really appreciate your hard work ❤️. Please make more videos on django <3

Ответить
Thar Lin Htet
Thar Lin Htet - 09.06.2020 18:36

Very easy to understand explaination.

Ответить
Mohamed Moselhy
Mohamed Moselhy - 30.05.2020 02:33

Well-explained, thank you for this!

Ответить
Akshat Singh
Akshat Singh - 26.05.2020 20:56

sir can u please make a video on django channels real time chat app with rest api

Ответить
Gaurav
Gaurav - 20.05.2020 13:07

Thanks a lot

Ответить
syed Shahbaz
syed Shahbaz - 05.05.2020 08:53

Dear sir please explain oneTOone field too. Please

Ответить
Sowjanya
Sowjanya - 04.05.2020 22:52

so helpful

Ответить
Shivam Jha
Shivam Jha - 01.05.2020 10:43

How do we make the serializer class and how do we make views for these relations? All the fucking tutorials on the entire internet just focusses on bullshit useless shell!!! Wtf are we going to do with the shell? Show how to actually make an api out of it! This is soooo dumb. I can't find a single video/documentation that covers this together on the internet. Fuck this world. Fuck django fuck programming. Fuck meeee

Ответить