Database Model Queries | Django (3.0) Crash Course Tutorials (pt 7)

  Рет қаралды 161,534

Dennis Ivy

Dennis Ivy

Күн бұрын

Пікірлер: 160
@DennisIvy
@DennisIvy 5 ай бұрын
Don't forget to check out my Complete Django course! dub.sh/NvGboTI
@jakeroosenbloom
@jakeroosenbloom 4 жыл бұрын
Holy shit dude this might be the best tutorial series on any subject ever I have seen on KZbin (not just programming or web development)
@DennisIvy
@DennisIvy 4 жыл бұрын
Haha thanks Jake :)
@kken8766
@kken8766 4 жыл бұрын
I've done 2 Udemy Django classes and 2 youtube tutorial series and this is by far the best of them. The way you take your time to make the slides and layout the queries function and example shows that you care about us. thanks.
@rokhribar5512
@rokhribar5512 4 жыл бұрын
Could you recommend a follow up course/site for us beginners after this crash course? Ty
@joaojesus8861
@joaojesus8861 3 жыл бұрын
Dennis I cannot stress how helpful and clear your work is. Other channels don’t explain properly or complicate it too much when the point is to introduce simple topics. Im sure you are going a long way ;) Wish you all the best mate!
@LetCode96666
@LetCode96666 4 жыл бұрын
Dennis, I can't thank you enough! This "query_set" part was killing me! Even the Django documentation does not cover this topic properly!
@reetamchatterjee2179
@reetamchatterjee2179 4 жыл бұрын
Best django series on youtube. Learning a lot!! Thanks Dennis!!
@akramnarejo6221
@akramnarejo6221 3 жыл бұрын
guess what? today you made me realize that it is the teacher who makes an student interested in learning. believe me constantly I am watching and learning ur tuts and did not get bore yet. truly love you man.
@akramnarejo6221
@akramnarejo6221 3 жыл бұрын
before you I have watched others too but fortunately ended up to urs tuts.
@kewartoscar8913
@kewartoscar8913 4 жыл бұрын
Thanks for your precious service to humanity. I nearly quit Django and I chanced on your videos on youtube. You have inspired new hope in me, and have increased my passion for Django. I am amazed by your selfless nature, and your willingness to share knowledge and help others.
@veyselaksin
@veyselaksin 3 жыл бұрын
I think this is best ever Django course in KZbin. You explain things simply! Thank for this course.
@sangeethsubramoniam3094
@sangeethsubramoniam3094 3 жыл бұрын
Cheat sheet .... Welcome ! #***(1)Returns all customers from customer table customers = Customer.objects.all() #(2)Returns first customer in table firstCustomer = Customer.objects.first() #(3)Returns last customer in table lastCustomer = Customer.objects.last() #(4)Returns single customer by name customerByName = Customer.objects.get(name='Peter Piper') #***(5)Returns single customer by name customerById = Customer.objects.get(id=4) #***(6)Returns all orders related to customer (firstCustomer variable set above) firstCustomer.order_set.all() #(7)***Returns orders customer name: (Query parent model values) order = Order.objects.first() parentName = order.customer.name #(8)***Returns products from products table with value of "Out Door" in category attribute products = Product.objects.filter(category="Out Door") #(9)***Order/Sort Objects by id leastToGreatest = Product.objects.all().order_by('id') greatestToLeast = Product.objects.all().order_by('-id') #(10) Returns all products with tag of "Sports": (Query Many to Many Fields) productsFiltered = Product.objects.filter(tags__name="Sports") ''' (11)Bonus Q: If the customer has more than 1 ball, how would you reflect it in the database? A: Because there are many different products and this value changes constantly you would most likly not want to store the value in the database but rather just make this a function we can run each time we load the customers profile ''' #Returns the total count for number of time a "Ball" was ordered by the first customer ballOrders = firstCustomer.order_set.filter(product__name="Ball").count() #Returns total count for each product orderd allOrders = {} for order in firstCustomer.order_set.all(): if order.product.name in allOrders: allOrders[order.product.name] += 1 else: allOrders[order.product.name] = 1 #Returns: allOrders: {'Ball': 2, 'BBQ Grill': 1} #RELATED SET EXAMPLE class ParentModel(models.Model): name = models.CharField(max_length=200, null=True) class ChildModel(models.Model): parent = models.ForeignKey(Customer) name = models.CharField(max_length=200, null=True) parent = ParentModel.objects.first() #Returns all child models related to parent parent.childmodel_set.all()
@abdinasirmohamed8981
@abdinasirmohamed8981 6 ай бұрын
thank you and i wish you the best
@anishamalblanco7386
@anishamalblanco7386 4 жыл бұрын
Thank you Dennis. This Django series is by far the best series on the internet. Learning a lot from it. Learnt Python from CodeWithHarry, and learning Django from you. I can't thank you enough for this awesome tutorial. Love from Nepal Brother.
@luizzeduardo341
@luizzeduardo341 5 жыл бұрын
Very good your explanations, congratulations for the content and the prepared material. Excellent quality!
@DennisIvy
@DennisIvy 5 жыл бұрын
Thank you Luiz:)
@talha_anwar
@talha_anwar 4 жыл бұрын
This tutorials is far better than many paid. to the point, precise theory concept before implementation
@earljohncalizar1154
@earljohncalizar1154 4 жыл бұрын
I'm not gonna lie. This channel is awesome. Got udemy courses and some youtube playlist. But this MAN really THE BEST OF IT. Thanks sir. SAVE ME ON MY SCHOOL PROJECT
@barscankurt4854
@barscankurt4854 4 жыл бұрын
So far so good. This tutorial is really detailed, organized and understandable. If you make all of your tutorials like this eventually people gonna discover this channel. You can be the next "code with mosh".
@ajaykjoshi
@ajaykjoshi 3 жыл бұрын
From 11.01-11.11 instead of using multiple newline you can use ctrl+l that can throw all your terminal codes to above unseen area. Thank you.
@shefat9892
@shefat9892 4 жыл бұрын
659 likes over against 1 dislike describe how gracefully you explained everything...
@philiponyeachonam6724
@philiponyeachonam6724 4 жыл бұрын
this is one of the best tutorials out here on Django, I really understood the database queries more than any pdf or youtube videos. Thanks a lot Sir
@mohammedqadir3851
@mohammedqadir3851 4 жыл бұрын
Thank you sir clear all concept of Django.
@xendat
@xendat 18 күн бұрын
Thank you! Great training! The link to the source does not work in any of these videos in the playlist for me.
@CraftscollectionCoUkshop
@CraftscollectionCoUkshop 4 жыл бұрын
Thanks so much Denis. Can't believe that your tutorials are free. Better than Python Django Bootcamp that I bought on Udemy which is never updated. Usually I don't subscribe to KZbin but has to do it on yours because of how good it is. Keep it up.
@DennisIvy
@DennisIvy 4 жыл бұрын
Thank you :)
@xochdt
@xochdt 4 жыл бұрын
I love how you teach. If it wasn't for you I'd probably wouldn't have followed my programing learning. Sincerly, thanks
@DennisIvy
@DennisIvy 4 жыл бұрын
Wow that inspires me! Thank you for taking the time to comment :) Best of luck
@othmanechalal2401
@othmanechalal2401 Жыл бұрын
Thank you for everything dude! But we can't have access to the source code anymore plz fix it
@yashraj67575
@yashraj67575 4 жыл бұрын
Hey Dennis, this goes to you... You have taught in the best way possible... KUDOS!!! 👌🙏
@ioan-alexandruilasi6987
@ioan-alexandruilasi6987 4 жыл бұрын
Who else decided to learn about web development while in lockdown? :)
@DennisIvy
@DennisIvy 4 жыл бұрын
It's a great use of time :)
@maniprasaddumre4403
@maniprasaddumre4403 4 жыл бұрын
I am here trying to learn programming first time through web dev by this YT series. Awesome Videos
@GauravKumar-lb6ze
@GauravKumar-lb6ze 4 жыл бұрын
+1
@NNote-zs6eo
@NNote-zs6eo 4 жыл бұрын
+1
@AnilSoni-mk9kx
@AnilSoni-mk9kx 4 жыл бұрын
Me
@kesmktmm
@kesmktmm 4 жыл бұрын
One of the smoothest tutorial set I've ever seen.. Thank you!
@kevincampbell256
@kevincampbell256 3 жыл бұрын
Thanks Dennis, I really appreciate this series you created.
@sanjayshirodkar
@sanjayshirodkar 4 жыл бұрын
This course is the best ... I am learning so much doing this course. Thanks a ton Dennis.
@nakhan69
@nakhan69 2 жыл бұрын
K Ken I totally agree with you, I am a beginner and I find it very useful. Thank you Dennis
@llewellynhattingh3496
@llewellynhattingh3496 4 жыл бұрын
you are incredible! You deserve a nice cold beer! Thanks so much, helped me a lot
@udbhavn8368
@udbhavn8368 4 жыл бұрын
Ohh man i finally found a good django course...Really love the effort you put into theses videos man...Amazing
@shivamm3401
@shivamm3401 4 жыл бұрын
This is a great series, so easy to follow and descriptive. Keeps me motivated!
@grzegorz-gregmika8339
@grzegorz-gregmika8339 5 жыл бұрын
Hope you never stop, great job! Think about document DB or Firebase
@DennisIvy
@DennisIvy 5 жыл бұрын
Im blown away by how much support I get over this series, thank you! I’m taking this comment into consideration for my next videos :)
@muhammadsameer9647
@muhammadsameer9647 3 жыл бұрын
Man the way you teach is awesome.
@medoune89
@medoune89 4 жыл бұрын
WAOUH !!!! VERY COMPLETE PLAYLIST for Beginner
@l4m5
@l4m5 5 жыл бұрын
The way you structured this tutorial on django alongside the source code is amazing... Please do a tutorial on how you hosted it onto heroku... Thanks
@DennisIvy
@DennisIvy 5 жыл бұрын
Putting this app on heroku soon, hopfully this week :)
@shishirantonyfernandis8454
@shishirantonyfernandis8454 4 жыл бұрын
Hey Denise, thank you for this tutorial, really helpful. Could you show how to create a customized id field in a model?
@DennisIvy
@DennisIvy 4 жыл бұрын
I'd have to do some research on that myself. Haven't really customized any fields outside of adding some widgets. I'm make a video on this once i do some more research :)
@shishirantonyfernandis8454
@shishirantonyfernandis8454 4 жыл бұрын
@@DennisIvy Sure. Meanwhile ,I've worked on a code myself, where I call a function from a field to add data and set the field to uneditable
@successsoi
@successsoi 4 жыл бұрын
Dennis thanks a lot for this tutorial. My question is the queriesDemos.py file, do we have to create one for whatever app we are building before we can actually query our database in our templates?
@Saketh-Chandra
@Saketh-Chandra 2 жыл бұрын
No need, Dennis is just showing examples.
@luisdesousa1789
@luisdesousa1789 Жыл бұрын
Hi Dennis thank you for your youtube tutorials I know it has been a long time since you posted this one, but I got to ask the source code is not working is there any way we can get them again thank you keep up the great work
@mursalrabb6093
@mursalrabb6093 3 жыл бұрын
Definitely the best series on django @YT
@Copt774
@Copt774 5 ай бұрын
This is great but how do I access the source code/files? I wanted to retrieve the query examples file but can't find it. Thanks!
@louzynerd129
@louzynerd129 4 жыл бұрын
where is the link :P I had to search the documentation online
@sagargahatraj5196
@sagargahatraj5196 4 жыл бұрын
hey dennis bro please show how to pull the data from many to many datas from table
@md.shariarkabir7350
@md.shariarkabir7350 4 жыл бұрын
I didn't find the query cheatsheet in github.
@aswn18
@aswn18 3 жыл бұрын
13:15 will product.name work instead of product__name, both mean the same right?
@ettitaiwo1642
@ettitaiwo1642 2 жыл бұрын
hi the source code link isn't working
@amanojha924
@amanojha924 2 жыл бұрын
Can you make one for uploading excel file and how to CRUD it in db
@upgradenowutubechannel391
@upgradenowutubechannel391 4 жыл бұрын
You are doing so gooood! I hope you will be famous one day..just keep on working like that ❤👌👍
@DennisIvy
@DennisIvy 4 жыл бұрын
Haha I appreciate that :)
@BardichTech
@BardichTech 2 жыл бұрын
Hi Dennis, thanks a lot for your effort and you're really a good instructor, good luck
@JOAOFELIPEQUENTINO
@JOAOFELIPEQUENTINO 7 ай бұрын
why the links of the description of other materials never are in the description 😭
@binghamdt
@binghamdt 5 жыл бұрын
A great explanation and a superb set of tutorials. One question. Could not an order have many products as opposed to just a single one in your example?
@DennisIvy
@DennisIvy 5 жыл бұрын
In this case no. Its a purchased item and not a set of orders. So lets say you place an order on amazon, you can have a shopping cart full of orders that relate to many products but each individual order must tie only to one product. You could however have quantity attribute. Is that what you were thinking?
@binghamdt
@binghamdt 5 жыл бұрын
@@DennisIvy Yes that was my idea. Again thanks for all the hard work on the tutorials.
@DennisIvy
@DennisIvy 5 жыл бұрын
Your welcome David :) it makes me very happy when I get feedback on everyone’s progress. Glad I can help :)
@ansariarbaz3374
@ansariarbaz3374 4 жыл бұрын
You know there are turns in life whereafter everything becomes smooth. Your vedios are like dat turn awesome dude..
@tanishtyagi1301
@tanishtyagi1301 4 жыл бұрын
is there a way to query by row number in django. e.g. return row data of row #1?
@axlblazeauthor
@axlblazeauthor 2 жыл бұрын
Hey Dennis just wanted to let you know that your source code link inst working...
@abhi-rw5lt
@abhi-rw5lt Жыл бұрын
sad, link is not working, i cant access the source code :(
@eleighanneaveno655
@eleighanneaveno655 2 жыл бұрын
Thank you for these videos. I love this content so much!
@dorakadri476
@dorakadri476 Жыл бұрын
the code source is missing :(
@amolgode9843
@amolgode9843 3 жыл бұрын
Hello Sir can you help me in this...? 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..?
@avikumar9046
@avikumar9046 4 жыл бұрын
Sir your Videos are just Awesome thanks a lot..Love from India.
@louismefor9539
@louismefor9539 5 жыл бұрын
Hi dennis with regards to the query about "number of balls a customer has ordered" why have you used the double underscores whereas the relationship between a customer and an order is one to many relationship? this is the query i am referring to ballOrders = firstCustomer.order_set.filter(product__name="Ball").count()
@DennisIvy
@DennisIvy 5 жыл бұрын
Great question :) Double underscores can be used in many ways. In this case I use it to chain upwards and access an attribute of the product model (name). Because our query starts at customer we had to go three levels deep: Customer --> Order --> Product 1. We query all orders to that customers with "order_set.filter()" 2. Then we need to get all orders that are related to the product with the attribute of "ball" so we access the product.name by doing product__name in the "filter()" method. Sorry I hope that makes sense. Kind of tough to explain.
@louismefor9539
@louismefor9539 5 жыл бұрын
@@DennisIvy OK in other words you can use that for either many to many or many to one right?
@amiruldheen4819
@amiruldheen4819 8 ай бұрын
source code not available
@tokhenz
@tokhenz Жыл бұрын
Hi, are you going to address the complaints regarding the missing source code?
@aydenkoperta6266
@aydenkoperta6266 4 жыл бұрын
Hi Dennis. Your video is awesome. It is really nice and understandable. Keep going. And I think you are the best Django teacher because on Russian youtube or American I don't see normal videos. You the best #DennisIvyTheBest #2020
@dimekarl4142
@dimekarl4142 4 жыл бұрын
i'm getting an error working on the shell after print(customers) return Database.Cursor.execute(self, query, params) django.db.utils.OperationalError: no such table:
@beakmann
@beakmann 4 жыл бұрын
Run $ python manage.py migrate
@doungchansroeun766
@doungchansroeun766 3 жыл бұрын
how to get queriesDemos.py file?
@nguyenquang97
@nguyenquang97 4 жыл бұрын
I download your source code but It still has some error in queryDemos.py
@scattyrot
@scattyrot 3 жыл бұрын
can we use default dict for allOrders?
@alieeldeenahmed2278
@alieeldeenahmed2278 4 жыл бұрын
When i wrote customers = Customer.object.all() and then print it that what appeared '' no names appeared so what is the problem??
@jaitungodhani2334
@jaitungodhani2334 3 жыл бұрын
In this, order_set method not work plz you have any solutions tell me
@dimpledivya2315
@dimpledivya2315 4 жыл бұрын
Its a very nice and useful video i like it must
@saidtahmazov9197
@saidtahmazov9197 2 жыл бұрын
Your series are just awesome, man! I do my best to support you with likes, subscruption, recommendations etc.
@amanbhullar1908
@amanbhullar1908 4 жыл бұрын
Hi Dennis Ivy .I am following your tutorials i really like the way you are explaining the things . can you please suggest other projects so i can work as a beginner to explore more about django. Thanks
@youcef659
@youcef659 4 жыл бұрын
I wanna thank you for your efforts and for the amazing videos you make with a very good explanation good luck
@kishanpanchal5009
@kishanpanchal5009 4 жыл бұрын
bro this video is really cool and intrustinng thanks and i really appreciated for this type of presentation on Django,
@apolovzla_ccs
@apolovzla_ccs 4 жыл бұрын
Hi guys, hi Dennis. Thank you very much for your effort in creating this course. I have a question related to the ball case in the last part of the video, wouldn't it be easier to add a quantity field to the order table for each chosen item?
@jaitungodhani2334
@jaitungodhani2334 3 жыл бұрын
'Customer' object has no attribute 'order_set' this error arrives when i test
@khaki714
@khaki714 3 жыл бұрын
Well done. Nice series.
@hyperxelon2838
@hyperxelon2838 3 жыл бұрын
Your videos are awesome easy to understand
@UmangDhandhania
@UmangDhandhania 4 жыл бұрын
How can I have more project based courses like these on Django? @Dennis Ivy. I'm up for paid courses.
@naheanmahamud6391
@naheanmahamud6391 Жыл бұрын
Your Source code + Live Demo Link Can't Work Please Check this problem
@dawid_dahl
@dawid_dahl 3 жыл бұрын
Thank you so much! (Great little cheat sheet, too. Saved!)
@dharshinim266
@dharshinim266 2 жыл бұрын
'Customer' object has no attribute 'order_set' this error arrives when I test.Can someone please help me with that
@romit5867
@romit5867 4 жыл бұрын
your tutorial is awesome and really appreciate the way you explain... thank you.... right now i am going to subscribe and hit that bell icon
@venkatrao235
@venkatrao235 3 жыл бұрын
nice explanation sir tq ,query for students having equal marks how can give ranks by date of birth
@pinakisingharoy202
@pinakisingharoy202 Жыл бұрын
your given Source code link is not opening.
@EltigreTafur
@EltigreTafur 4 жыл бұрын
how return the response to template
@qwertysriram
@qwertysriram 5 жыл бұрын
Doing a great job bro..................i have a doubt, which is the best database for django other than the default sqlite?
@DennisIvy
@DennisIvy 5 жыл бұрын
Definitely Postgres. Although you can use any database, Django was built with postgres in mind so integration is seamless. I’ll be making a video on how to do this soon :) and thank you for the support!
@mohcench1903
@mohcench1903 4 жыл бұрын
thank you so much for your work , the way u explain is amazing keep it up :)
@abdulwadood9484
@abdulwadood9484 4 жыл бұрын
Bro you doing well. Keep doing for us
@AbdallahSallam88
@AbdallahSallam88 4 жыл бұрын
Search this for the documentation QuerySet API reference
@Nemosaur
@Nemosaur 3 жыл бұрын
Super helpful! Thanks so much!
@successpaulhart
@successpaulhart Жыл бұрын
thanks Mr dennis
@RavinderSingh-un7ky
@RavinderSingh-un7ky 5 жыл бұрын
Can you make a video on middlewares, context managers, Restful web API
@DennisIvy
@DennisIvy 5 жыл бұрын
Yep! Middleware and a rest API course are actually on my list of videos to do :)
@nishantpacharne1569
@nishantpacharne1569 4 жыл бұрын
Please Dennis make a series of Html Css and Bootstrap , please !!!! , and by the way you create awesome stuff !!
@fazliddinfayziev-qg1vg
@fazliddinfayziev-qg1vg Жыл бұрын
Hi everybody, guys where can I find the source code. I am Query cheatsheet. Can you help me please ?
@devanshsolani2593
@devanshsolani2593 4 жыл бұрын
Is it really useful to learn this commands? As we can do it from admin panel😃
@DennisIvy
@DennisIvy 4 жыл бұрын
It never hurts to learn these commands. And I have actually use them alot in the past when updating or merging databases.
@devanshsolani2593
@devanshsolani2593 4 жыл бұрын
@@DennisIvy I did not expect you to reply so soon. Thanks a lot buddy. Youre doing a great job😊
@leomacenauer3433
@leomacenauer3433 4 жыл бұрын
Thanks a lot ! Amazing work !
@HydoSkills
@HydoSkills 2 жыл бұрын
Me a 35 yo male: haha peter piper initial are P, P.. Good tutorial series my man!
@EltigreTafur
@EltigreTafur 4 жыл бұрын
Hola comunidad una pregunta como puedo pasar esta consulta sql a mi template desde la vista en forma de ciclo query = 'SELECT mantenimiento_mantenimiento.id ,mantenimiento_mantenimiento.phone , mantenimiento_mantenimiento.user , usuarios_user.first_name FROM mantenimiento_mantenimiento, usuarios_user where mantenimiento_mantenimiento.user = usuarios_user.id' #for list_art in Mantenimiento.objects.raw(query):
@louismefor9539
@louismefor9539 5 жыл бұрын
Hey Dennis merry christmas!!!!!!!!!!, i cant find the cheat sheet in the source code
@louismefor9539
@louismefor9539 5 жыл бұрын
My bad, i have seen it
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН
Django ORM Primer - Django QuerySet API and QuerySets
15:07
Very Academy
Рет қаралды 10 М.
PostgreSQL CRASH COURSE - Learn PostgreSQL in 2024
50:26
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН