Unerstanding the relationship between functions DJANGO

Need a good resource for understanding the many to one, one to many, one to one relationship and why we use them.

I kind of understand the reasoning why. So that we don’t delete objects that we want to keep, but what are we doing under the hood?

any help would be much appreciated! :slight_smile:

What’s going on under the hood has more to do with databases than Django itself. Django is just creating those relationships in the code you write, but then it gets translated over (see ORM) to your database!

In other words, Django is creating and interacting with your database, but those relationships are the foundations of your database, of which we glimpse at with DataGrip.

Check out Mosh’s SQL Course, or research relational databases. I’m still coming to grips with how it all works too :smiley:

1 Like

Thank you!
This actually helps out a lot each of the functions such as Foreignkey are related to database relationships between different data that is stored.

its starting to come together. I was looking at the models and I was just pulling these functions from django and had no clue what we were doing until I read your comment. Cheers

1 Like

For sure! It’s something I don’t understand well and need to research further. When I find some good explanations I’ll post the links here :+1:t4:

Here are some great resources!

Understand Database Relationships in Django.

Edit: this article and video are great too
What is a foreign key? (With SQL examples).