#7 Django tutorials | Addition of Two Numbers in Django

  Рет қаралды 220,935

Telusko

Telusko

Күн бұрын

In this lecture we will discuss:
we will doing operation on our code
#1 create result.html file in templates
#2 create a function in views.py name add function
#3 create a url for add function
#4 create a form in home.html
#1 create result.html file in templates
-- in this file we will show the result of our operation
-- using {{}} we will show the result
#2 create a function in views.py name add function
-- in this function we will take two number from user
-- we will add these two number and store in a variable
-- we will pass this variable to result.html file
-- we will return render(request,'result.html',{'result':result})
#3 create a url for add function
-- in this url we will pass two number
-- we will call add function and pass these two number
-- we will return the result of add function
#4 create a form in home.html
-- in this form we will take two number from user
-- we will pass these two number to add function
Python Tutorials for beginner : bit.ly/2qfhUCp
Django Tutorials : • #1 Django tutorials | ...
Github :- github.com/nav...
Django is a high-level Python-based free and open-source web framework, which follows the model-view-template (MVT) architectural pattern.
It is maintained by the Django Software Foundation (DSF).
Django's primary goal is to ease the creation of complex, database-driven websites.
Some well-known sites that use Django include the Public Broadcasting Service, Instagram, Mozilla, The Washington Times, Disqus, Bitbucket, and Nextdoor.
Editing Machines & Monitors :
amzn.to/2HA6ra8
amzn.to/2VMBBPw
amzn.to/2RfKWgL
amzn.to/2Q665JW
amzn.to/2OUP21a.
Check out our website: www.telusko.com
courses.telusko.com
Instagram : / navinreddy20
Twitter : / navinreddy20
Facebook:
Telusko : / teluskolearn. .
Navin Reddy : / navintelusko
Subscribe to our other channel:
Navin Reddy : / @navinreddy
Telusko Hindi : / @teluskohindi
Donation & Support:
Indian Payment : www.instamojo....
PayPal Id : navinreddy20
Patreon : navinreddy20

Пікірлер: 242
@kannacsm737
@kannacsm737 4 жыл бұрын
great explanation , smiling for errors shows developers attitude!!!!!!!! good job telusko team
@pavankumarmadasu8598
@pavankumarmadasu8598 5 жыл бұрын
ur energy while explaining anything : always super energy
@ArjunKrishna-lx1re
@ArjunKrishna-lx1re 3 жыл бұрын
I am getting error as multivaluedictkeyerror,how can I resolve
@reydavian3723
@reydavian3723 3 жыл бұрын
i realize Im kinda off topic but do anyone know a good website to watch newly released movies online?
@graysonmaximilian8516
@graysonmaximilian8516 3 жыл бұрын
@Rey Davian i watch on flixzone. You can find it by googling =)
@bishopgianni9214
@bishopgianni9214 3 жыл бұрын
@Grayson Maximilian yea, I have been using flixzone for years myself :D
@reydavian3723
@reydavian3723 3 жыл бұрын
@Grayson Maximilian Thank you, signed up and it seems like a nice service :D I appreciate it !
@vinayak254
@vinayak254 2 ай бұрын
This one is a very important video. many of other tutorials in youtube did not give this kind of actual operation. By seeing this, I could do what i want to do in my code. Thank you very much
@ihcc6667
@ihcc6667 4 жыл бұрын
You made it super simple. I have spent hours watching countless tutorial but couldn't get it. Great Job Telusko
@ArjunKrishna-lx1re
@ArjunKrishna-lx1re 3 жыл бұрын
I am getting error as multivaluedictkeyerror,how can I resolve
@subikeshps2289
@subikeshps2289 4 жыл бұрын
To convert the inputs to integer, the int() function works good, even with double quotes. Perhaps in this video, the refresh didn't work correctly. Great explanation sir. I really like your tutorials.
@thirumalairajan3540
@thirumalairajan3540 3 жыл бұрын
thanks bro you have solved my doubt
@talhatayyab6422
@talhatayyab6422 3 жыл бұрын
When you add 5 plus 6 you get 56... this one was awesome Sir!!! Love your lectures....
@siddiqzaryab
@siddiqzaryab 4 жыл бұрын
Hey, Navin! Is it absolutely necessary to have knowledge of HTML/CSS and JavaScript before starting Django or Can we learn it as we work on Django along the way? Your tutorials are awesome by the way. :)
@friendlycreeper1045
@friendlycreeper1045 Жыл бұрын
It is necessary to have knowledge of HTML/CSS but not javascript cuz we are replacing it with python (Django). You can learn them along the way too
@akashgillella
@akashgillella 4 жыл бұрын
Anna, super anna! Chala baavunnai tutorials. Nee teaching, energy kuda adirindhi.
@victorystocktv
@victorystocktv 4 жыл бұрын
1:00 form 5:00 As a client, When you send a request to this server, you basically sending an object and that object will have some values (num1, num2) When server send you value back, it will be in a format of response 7:40 add 빼먹지 말자. Thank you
@christcentric6438
@christcentric6438 5 жыл бұрын
For those who are not getting the result page when clicked on submit please note that in this code it should be
@romit5867
@romit5867 4 жыл бұрын
didnt worked brother
@geekydevelop
@geekydevelop Жыл бұрын
@@romit5867 in result.html check whether the extend base.html is written in single quotes or not
@hasib4joy
@hasib4joy 4 жыл бұрын
When 1st you didn't called for int of num1 a d num2 I just thought 'How a champ like you can miss it.' Letter I got this the way of your teaching. nice way
@olkhovskyrus
@olkhovskyrus 5 жыл бұрын
Another solution to add numbers but not strings is to wrap variables in int() as we sum them. In my case it was c = int(a) + int(b)
@himanshu_nishad07
@himanshu_nishad07 4 жыл бұрын
I am watching all videos of Python, but when result comes 56 it's make laugh for me. It's commonly happen with developers. I have also faced this type of incident, before 4 year ago when I am coding with PHP. But your tutorial is awesome. I have learned lot's of concept of Python. Thanks to making this tutorials.
@ArjunKrishna-lx1re
@ArjunKrishna-lx1re 3 жыл бұрын
I am getting error as multivaluedictkeyerror,how can I resolve
@skviknesh
@skviknesh 3 жыл бұрын
Flow explained above SIMPLIFIED: Here we need to enter 2 numbers, add them & print result in new page. 1. In the home.html create a form to add 2 numbers home page. a. Need 2 text fields to get values & button to submit it. 2. Need a page to display the results (result.html) - create it. 3. Created a new page, need to register in "urls.py". 4. Now, page is created & registered in URL's => now we need logic for it. a. Create a function to add in "views.py" which gets the response from "home.html b. And return to "result.html 5. Finally, in "result.html" receive response in a variable. 6. DONE. Create a page -> register it in urls -> write logic in views -> receive in results.
@manpreetkaur6908
@manpreetkaur6908 5 жыл бұрын
Excellent stuff... I always watch your tutorials whenever get stuck...
@varunkrishnaKyathanpally
@varunkrishnaKyathanpally 5 жыл бұрын
Awesome tutorial. I understood that once we practice Django more, we can play with it.
@sauravrai5840
@sauravrai5840 2 жыл бұрын
Great explanation and love the energy and passion which you teach :)
@306Drago
@306Drago 4 жыл бұрын
In home.html you have to change the input type from "text" to int, then only it will accept addition.
@abhijithnm3071
@abhijithnm3071 5 жыл бұрын
waiting for your next video. can u explain also about creating restful api's
@abdelolayyan8008
@abdelolayyan8008 2 жыл бұрын
Thanks pro Excellent tutorial; I would rather name it {'resultVar':res} to be clear for the student and not confused . Thanks
@khushichaudharysart275
@khushichaudharysart275 5 жыл бұрын
Please upload more video soon And this series is amazing👌👌❤❤
@pooja6380
@pooja6380 3 жыл бұрын
Great explaination ..... Awesome tutorial.....
@marukondamahesh4651
@marukondamahesh4651 5 жыл бұрын
please upload more videos sir ,your explanation is amazing .
@Canadoloteluguammai
@Canadoloteluguammai 4 жыл бұрын
Hi Navin, can you explain me what does render module does ? In 6:42 return render(request,"result.html",{'result':res}) what does the third argument does ? how to create that and can someone explain me in brief? And suppose if i want to create a new app how can i add that in the path? what does the path does ?
@brahmanandadash8730
@brahmanandadash8730 4 жыл бұрын
Thanks Naveen....Much appreciated !!!!
@afolabisunday4183
@afolabisunday4183 5 жыл бұрын
Hi Navin nice Job with all your videos, please how can install Jinja on pycharm? Thanks
@samarthbagga7688
@samarthbagga7688 4 жыл бұрын
pip install jinja2
@nrknithin
@nrknithin 9 ай бұрын
Video was super informative, but i dont think the second time u got 35 when adding 3 & 5 was because u needed to pass single quotes, I think it was just same cached pages
@chetanbodra2154
@chetanbodra2154 4 жыл бұрын
Hey I don't have any idea of phyton so can I do this? ...Till here I understand the basics though as u have taught
@barunkumar9429
@barunkumar9429 4 жыл бұрын
while clicking submit it showing result on next page...Please help.. when we submit "It can show result on same page".
@utsabbera4365
@utsabbera4365 3 жыл бұрын
.....
@shivamkushwaha625
@shivamkushwaha625 5 жыл бұрын
Amazing explaination. Thank you
@Hey1Demo
@Hey1Demo Жыл бұрын
annayya nuvvu thoopu
@shivpradattagrawal1895
@shivpradattagrawal1895 5 жыл бұрын
sir if i am not giving any value then error occurs if after clicking button .
@rupeshbhosale3142
@rupeshbhosale3142 4 жыл бұрын
thank you Navin sir,for wonderful tutorial
@vineethkumar2272
@vineethkumar2272 5 жыл бұрын
Sir small doubt !! what is the difference between single quotes and double quotes in request.GET[].
@surajjena1437
@surajjena1437 3 жыл бұрын
Great explanation But why we are not providing the path in urls.py(telusko). Just like we have done in case of home function.
@anmolagarwal8373
@anmolagarwal8373 4 жыл бұрын
SIR, YOUR PYTHON TUTORIALS ARE GOOD ,THEY ARE EASY YO UNDERSTAND BUT SIR YOUR DJANGO TUTORIALS ARE QUITE FASTER WE ARE NOT ABLE TO CATCH THE THINGS PROPERLY ,WE ARE FACING DIFFICULTIES IN UNDERSATNDING YOUR CONCEPT....
@epic_clickks
@epic_clickks 4 жыл бұрын
Hello, In this episode you have created a button as SUBMIT can we change the text??
@sathvikmalgikar2842
@sathvikmalgikar2842 2 жыл бұрын
thank you sir
@suhaasmaheshwar5474
@suhaasmaheshwar5474 2 жыл бұрын
The confidence we get when you say we got the answer😃 (vs) The answer 🤣
@akhaled4990
@akhaled4990 3 жыл бұрын
Excellent video!
@djameleddinechahrat4926
@djameleddinechahrat4926 4 жыл бұрын
sir, can i use opencv with django?
@jayanthbalina5078
@jayanthbalina5078 3 жыл бұрын
great
@mdbhardwaj5005
@mdbhardwaj5005 4 жыл бұрын
I love your videos sir.
@rohansoudey6005
@rohansoudey6005 4 жыл бұрын
In path() what is use of name="" ?
@hasib4joy
@hasib4joy 4 жыл бұрын
If in the future you have to call the path. you can simply call them by the name. suppose calling the result page by /result, you can call call them by the name result. You will get the impact when you will have numbers of urls under one app.
@s2rthoughts425
@s2rthoughts425 4 жыл бұрын
i think you can use the name instead of page
@mkbhoir5923
@mkbhoir5923 3 жыл бұрын
I laughed so hard when result came out to be 56,btw nice work sir thank you for your hard work
@tushargoyaliit
@tushargoyaliit 5 жыл бұрын
The adding two nos not responsing at all after pressing 'submit' besides code written exactly the same Please help
@tushargoyaliit
@tushargoyaliit 5 жыл бұрын
it is processing ,not giving any result
@venky433
@venky433 5 жыл бұрын
@@tushargoyaliit give .action=add
@tushargoyaliit
@tushargoyaliit 5 жыл бұрын
@@venky433 please repeat
@tushargoyaliit
@tushargoyaliit 5 жыл бұрын
I need to give dot action?
@venky433
@venky433 5 жыл бұрын
@@tushargoyaliit you might not have given action='add' , one more reason is ,file is not yet saved
@motivationhub7294
@motivationhub7294 4 жыл бұрын
I now feel java is easy when comparing with python
@abdulselamtamene5812
@abdulselamtamene5812 3 жыл бұрын
nice
@sumauma6772
@sumauma6772 5 жыл бұрын
Very nice sir Explain about base. html file
@muhammadsultanularafin8846
@muhammadsultanularafin8846 5 жыл бұрын
Hi Navin I prefer your tutorials .How to show the result in the same page which contains the input fields?
@barunkumar9429
@barunkumar9429 4 жыл бұрын
Hi if you got the solution pls reply I am also facing same issue
@muhammadsultanularafin8846
@muhammadsultanularafin8846 4 жыл бұрын
@@barunkumar9429 Wilco.
@jaiprakashnarayanjha8862
@jaiprakashnarayanjha8862 5 жыл бұрын
I am facing problem: The adding two nos not responsing at all after pressing 'submit' besides code written exactly the same
@ashvindhawan153
@ashvindhawan153 5 жыл бұрын
I am having the same problem
@tushargoyaliit
@tushargoyaliit 5 жыл бұрын
@@ashvindhawan153 I am also facing the same problem
@venky433
@venky433 5 жыл бұрын
@@ashvindhawan153 , mention add in action
@Ajayk30
@Ajayk30 5 жыл бұрын
Even after adding form action it is not reacting
@sarvagyaiitmadras8727
@sarvagyaiitmadras8727 4 жыл бұрын
It is nothing related to form ="add" try copy it into a normal html page and run it, it will also show the same error of submit button, now what u have to do is "Write the same code of home.html form part in normal html page, then When u get submit button working copy itt back to django
@avijitpatra3965
@avijitpatra3965 3 жыл бұрын
7:00 thousand times for this channel
@491prasad
@491prasad 4 жыл бұрын
undoubtedly a superb explanation ... But still, is 5+6 =8?
@rohit_mondal__
@rohit_mondal__ 2 жыл бұрын
he later changed the values to 3 and 5
@adityahirwani1672
@adityahirwani1672 5 жыл бұрын
You are amazing.
@DeepakKumar-uz4xy
@DeepakKumar-uz4xy 5 жыл бұрын
Like return render(request' "base.html" , {'num': 'val3'} Then what we get
@yashrastogi3726
@yashrastogi3726 4 жыл бұрын
val3
@marwaelzaatari
@marwaelzaatari Жыл бұрын
if you are doing this tutorial, put num1 and num2 in double quotations to add both values :)
@vrajverma3907
@vrajverma3907 5 жыл бұрын
Sir, isn't is tool lengthy process!! Why we creating so much files??
@namrataingle6653
@namrataingle6653 4 жыл бұрын
can you please make tutorial of class based views using generics and how do we use function outside the class?
@mandeepubhi4744
@mandeepubhi4744 5 жыл бұрын
Awesome!.
@namesare4fools
@namesare4fools 4 жыл бұрын
Hi There ! Can you do a tutorial on how to do this operation using Ajax.. like, who wants to go to other page just to get the result ?
@srushtiagarwal2748
@srushtiagarwal2748 4 жыл бұрын
sir explanation was good as usual, but Getting Multidictkeyerror: num1 ??? tried to google it, but no sol.
@priyamjames7045
@priyamjames7045 4 жыл бұрын
Hi sir, When we clicked on submit, how it called directly the add url..where u have mentioned it??
@RavindraSingh-kn1sd
@RavindraSingh-kn1sd 4 жыл бұрын
we have written add in action of the form tag. So that will tell the page to find add function.
@yufoo
@yufoo 4 жыл бұрын
Result.html
@surahome
@surahome 4 жыл бұрын
than you
@md.emdadulhaque5245
@md.emdadulhaque5245 4 жыл бұрын
Thanks for your Great Explanation. How to calculate age? More specifically i want calculate retirement age of an employee where i will 60 year with date of birth of employee.
@ArjunKrishna-lx1re
@ArjunKrishna-lx1re 3 жыл бұрын
I am getting error as multivaluedictkeyerror,how can I resolve
@agranshuaggarwal3947
@agranshuaggarwal3947 4 жыл бұрын
awesome
@vamckrishna3458
@vamckrishna3458 2 жыл бұрын
For those who are getting errors when you use request.GET()/request.POST() method in views.py , Use request.GET.get() / request.POST.get() instead ... :)
@rabahmuhammed31
@rabahmuhammed31 7 ай бұрын
But after I get type error please help me bro
@anonymus1981
@anonymus1981 Жыл бұрын
"when you add 5 + 6 we get 56 that's weird " - sarcasm at the top😂😂😂👍
@HarshSharma-tp8bi
@HarshSharma-tp8bi 5 жыл бұрын
Which programing languages/software are required for Computer science in Specialization with Big Data Analytics Btech In India....
@pradeepch7051
@pradeepch7051 4 жыл бұрын
I think 'add()' is a reserved function in python now ..!
@ትኒጧትንኝ
@ትኒጧትንኝ 4 жыл бұрын
7:18: Telusko: 5+6=8 Aliens (Telusko’s audience): 5+6=11
@aishwaryakaduskar4174
@aishwaryakaduskar4174 4 жыл бұрын
because he changed the input value also.
@quranicscience9631
@quranicscience9631 4 жыл бұрын
Nice
@gauravpal-tp4pd
@gauravpal-tp4pd 3 жыл бұрын
Hi, can we calculate with two fields but given three?
@priyanshuchaudhary837
@priyanshuchaudhary837 4 жыл бұрын
THANKYOU SIR!!!!!!!!!!!!!!!!!!!!!!!!!!!
@Ansh_Rajpoot_
@Ansh_Rajpoot_ 3 жыл бұрын
7:27 it's not the problem og quotes its because you have not saved it...l.
@surahome
@surahome 4 жыл бұрын
thank you
@omarosman7384
@omarosman7384 4 жыл бұрын
What if i am getting the two numbers from the database not from the form? I used the add filter and I used custom filter but it did not work
@aghajeeducation
@aghajeeducation 4 жыл бұрын
Thumbs up x 100
@GRITGRINDGREATNESS
@GRITGRINDGREATNESS 3 жыл бұрын
hey Navin great lesson, but am getting this error when i try to GET val1 and val2: tuple object has no attribute get,
@harshitsukhija9626
@harshitsukhija9626 3 жыл бұрын
Me too, I think the new version of python had changed some directories.
@harshitsukhija9626
@harshitsukhija9626 3 жыл бұрын
I got the solution Use GET["num1"] instead of GET("num1")
@Youssouf_Maroci
@Youssouf_Maroci 4 жыл бұрын
when I click submit page wouldn't reload and i have this errors: Not Found: /js/scripts.js Not Found: /css/styles.css solution plz !!!
@tancodes
@tancodes 3 жыл бұрын
you must have not given the correct path
@harshitjaysansharma9379
@harshitjaysansharma9379 5 жыл бұрын
which sofftware for django are you using sir i want that xD
@khushboodubey2647
@khushboodubey2647 Жыл бұрын
😂i got a good laugh when he saya 5 plus 6... 56 😂😂something wrong
@syrgakomuraliev
@syrgakomuraliev 4 жыл бұрын
4:10 maybe 'add/' - slash
@romit5867
@romit5867 4 жыл бұрын
thanks bro.. it was saying syntax error
@DeepakKumar-uz4xy
@DeepakKumar-uz4xy 5 жыл бұрын
What if we put base.html instead of result.html in add function's 'return
@pranavpandiri3056
@pranavpandiri3056 6 ай бұрын
In the home.html the type of the variable is set as text
@sandeepmandavilli4512
@sandeepmandavilli4512 4 жыл бұрын
in code u wrote submit but in the page it came submit query how???
@aniketghotale6926
@aniketghotale6926 5 жыл бұрын
6:25 😂😂
@cse-c515prasanth6
@cse-c515prasanth6 3 жыл бұрын
Yeah ,i got surprised😂lol
@vishwanathbhat3019
@vishwanathbhat3019 3 жыл бұрын
instead we can just mention input type=int in home.html that would also do the work
@shishirsiddharth7069
@shishirsiddharth7069 3 жыл бұрын
In addition of two numbers part of this I get an error TypeError: 'module' object is not iterable and also in the end it says probably caused by a circular import. Pls help me out and consider me a newbie to django. Thanks!
@pradeep.s842
@pradeep.s842 Жыл бұрын
Nice Lecture Bro....5+6=56...... Thats Too Weird🤣🤣🤣🤣
@HGGTUKJN
@HGGTUKJN 4 жыл бұрын
Is there any chance of using cripsy forms with such solution?
@manojkumar-lt6wk
@manojkumar-lt6wk 4 жыл бұрын
If I press submit button twice, it is searching for the sub url- "add/add?.." which is giving me an error.. help please??
@meghanadokku1909
@meghanadokku1909 2 жыл бұрын
Here while adding the 5 and 6 why the output is 8. We have get the result 11
@sumauma6772
@sumauma6772 5 жыл бұрын
Explain about base.html
@omarosman7384
@omarosman7384 4 жыл бұрын
How can I declare integer variable inside template?
@laveshmarathe4401
@laveshmarathe4401 5 жыл бұрын
sir m working in telecom sector since 2 yrs want to switch in IT plz guide me
@gopalakrishnadoddi4869
@gopalakrishnadoddi4869 4 жыл бұрын
sir do we need internet to work in visual studio code
@prettycode4028
@prettycode4028 5 жыл бұрын
hey thanks sir!
@kaustuvkchattopadhyay8566
@kaustuvkchattopadhyay8566 4 жыл бұрын
6:14 XD. Thanks a lot
@Viralvlogvideos
@Viralvlogvideos 3 жыл бұрын
6:32 for me double quote is also working sir
@yaswanthmotikavalasa2840
@yaswanthmotikavalasa2840 Жыл бұрын
You haven't used csrf token still its working 🤔🤔 ?
#8 Django tutorials | GET vs POST | HTTP Methods
6:07
Telusko
Рет қаралды 201 М.
ТИПИЧНОЕ ПОВЕДЕНИЕ МАМЫ
00:21
SIDELNIKOVVV
Рет қаралды 1,4 МЛН
Running With Bigger And Bigger Lunchlys
00:18
MrBeast
Рет қаралды 136 МЛН
didn't manage to catch the ball #tiktok
00:19
Анастасия Тарасова
Рет қаралды 31 МЛН
小天使和小丑太会演了!#小丑#天使#家庭#搞笑
00:25
家庭搞笑日记
Рет қаралды 57 МЛН
#5 Django tutorials | Django Template Language | DTL
8:45
Telusko
Рет қаралды 318 М.
Python Projects for Beginners - Master Problem-Solving! 🚀
53:00
Programming with Mosh
Рет қаралды 65 М.
#21 Django tutorials | User Registration - 1
13:45
Telusko
Рет қаралды 259 М.
#11 Django tutorials | Static Files - 2
10:02
Telusko
Рет қаралды 204 М.
How to Get  Input From HTML Form using Django ? | Tamil.
18:10
Software & Web Technology
Рет қаралды 18 М.
Python Decorators in 15 Minutes
15:14
Kite
Рет қаралды 446 М.
I learned to code from scratch in 1 year. Here's how.
41:55
Thomas Frank
Рет қаралды 418 М.
#17 Django tutorials | Models and Migrations
12:13
Telusko
Рет қаралды 220 М.
Python Django Tutorial for Beginners
1:02:36
Programming with Mosh
Рет қаралды 2,6 МЛН
#4 Django tutorials | First App Django - part 2
7:54
Telusko
Рет қаралды 428 М.
ТИПИЧНОЕ ПОВЕДЕНИЕ МАМЫ
00:21
SIDELNIKOVVV
Рет қаралды 1,4 МЛН