Mr Brian is a Brillant teacher and the build up of the lesson apps is awesome,No wonder they produce whole new level of brillant pass out students with the teaching faculty and clarity of subject like this.Thank you so much Harvard and the biggest gift of our time " The internet".
A very dense and totally meaningful course! Instead of wasting time on nonsense coding bootcamps (html, css, python and Django) here you see the total pure logic background and create totally generic pages, submit buttons that does something and things changes according to input... I loved and each 5 mins or so wanted to press on the like button (first time ever) :)))
Brian should have his own software development learning startup and expand the content not covered on cs50! He'll give a real treasure to this world and earn 100 of millions if not billions doing so!
Brian is the best online teacher for me. i connect with his way of teaching so much that i understand everything he teaches so easily. i don't think i've enough words to thank him for this. God bless Brian
Around 25 min, when you already have dedicated views for Brian and David then I think you should prioritize them in first and the generic greet view comes later only in defining URLs paths. This is not an error but makes different logical outputs. I am really thankful for your teaching.
I was procrastinating while learning Django alot nothing new always happens to me , I was learning by Dj docs tuned this course on I have been studying for like 4-5 hrs now Brian got me hooked mann literally I wish i had a ai bot like brian that explained me everything i needed to know in my life
31:28 render(request ,html page,context) 37:01 newyear app 43:36 python logic 48:00 static file 01:13:13 the info is posted to the same page we are in 01:34:00 no such table . error
I suppose the collision error, 1:10:08, was somewhat intentional to explain the next steps in those cases. But in this part 54:07 you can look at settings.py tasks is added at the end (after newyear) and at 54:13 urls.py tasks/ is NOT added at the end but before newyear/, hence the error. * I put tasks in both cases (settings.py and urls.py) after newyear and there was no error.
There's a minimal logical error at the end since the "request.session[tasks]" only creates if the user goes first to the url "/tasks/", however if the user goes first to the url "/tasks/add" , the "request.session[tasks] is not created, so if the user tries to add a new task, it won't work. just a little observation, it was a great lecture
Yes, but add in def add(request): if "tasks" not in request.session: request.session["tasks"]=[] and this work fine! (if the user goes first to the url "/tasks/add")
How can he just do a lecture for nearly 2 hours straight with so much energy. I would fall asleep in the first 5 mins if I was him. Anyway I learnt alot from this lecture
I usually skip long videos but this thisss was totally worth it. a 1000 blessings to you. also whoever was in charge of the camera movements blew my mind.
at 1:36:17 when Brian changes the add function to, instead of updating the (deleted) global variable, update the task list in the session - why are we using this syntax += [task] ? I know that the += is shorthand for append, but why is 'task' , that is obtained from the cleaned_data of the form and is a string, not simply appended to request.session["tasks"]] which is a list via the .append() method? If I use request.session["tasks"].append(task) it doesn't work. I'm trying to understand why..... request.session["tasks"] = a list task = a string I should be able to use the append method on the list to append the string. I'm clearly missing something here. Anyone that can explain this?
Made a stackoverflow question for this because it was bugging me and in the video Brian just 'acts like this is normal syntax' :) stackoverflow.com/questions/63449525/append-to-request-sessionslist-in-django/63477092#63477092
hey, when you use .append() the session by default won't be saved. Documentation here: docs.djangoproject.com/en/2.2/topics/http/sessions/#when-sessions-are-saved I'm not sure, but it seems the syntax Brian used gets around that and forces Django to save the session without having to explicitly say: request.session.modified = True.
hey, when you use .append() the session by default won't be saved. Documentation here: docs.djangoproject.com/en/2.2/topics/http/sessions/#when-sessions-are-saved I'm not sure, but it seems the syntax Brian used gets around that and forces Django to save the session without having to explicitly say: request.session.modified = True.
append(): This does not work request.session["tasks"].append(task) but this work list_tmp = request.session["tasks"] list_tmp.append(task) request.session["tasks"] = list_tmp : )
1:36:25 why it doesn't work if we utilize append like this??? request.session["tasks"].append(task), it only works if we write request.session["tasks"] += [task]
the best way is to use dev tools in your browser and check the input fields and then grab predefined attributes. this works for me......very well..... but if you want use django thing use django widgets to set attributes first then use them in your css
I'm completely lost, couldn't follow along the Django installation and all the commands. I'm using Windows and wish to set up VS Code to use the terminal but i haven't found any useful docs / tutorial regarding the set up. Can anyone help?
On youtube I followed a tutorial from a guy named Tubemint for a python and django setup on windows. From there I installed vscode, and once I had python and django running I created my project and went to the cmd window and typed code . (remember there is a space and a period after code) which automatically opened my project on vs code. You can even open up the project folder on vs code and it will show every file for the project that way as well.
If you're on Windows I would highly recommend installing a bash environment program like Git Bash (included in Git for Windows) or Windows Subsystem for Linux. The commands that Brian uses in his zsh shell can be done verbatim in your bash shell.
copy paste my code in views.py and it will work: from http.client import HTTPResponse from django.http import HttpResponse from django.shortcuts import render # Create your views here. def index(request): return HttpResponse("Hello, world!")
I had the same result and did some experimenting. It is certainly not random. Django seems to look in in the 'last url in the project's urlpatterns list' first. (lecture3/urls.py) In your lecture3 project 'urls.py', if you change the list as follows: urlpatterns = [ path('admin/', admin.site.urls), path('tasks/', include("tasks.urls")), path('newyear/', include("newyear.urls")), path('hello/', include("hello.urls")), ] so that 'hello' is last (recall that the hello APP also has a path with a name of 'index'). If you would now link to url 'index' - django will always go the index url of the hello APP. As you can see at 54:10 , Brian (probably on purpose to drive his point home later) puts the path for tasks BEFORE the newyear path in the urlpatterns list. You and I added it to the end of the list and as such we did not produce this problem. Having said all of that - it is good practice to name your apps so you can explicitly link to them.
Great lecture. l had to pause in between for him to rest a bit.
loll
How very thoughtful of you
Wow brother 🤣🤣
😂😂😂😂
Definitely worthy of being Mr.Malans trustee he is getting all the Great teacher vibezz on him
really cs50 changed my life
Brian is brilliant teacher. I wish I could explain things like him in the future.
No words to appreciate this type of content available for free! Thank you so much for such engaging content CS50 team!
00:06:02 Django Project Setup
00:12:42 First View
00:14:19 Url setup
00:20:47 Additional Views
00:24:04 Parameterizing Views
00:27:22 Templates
00:43:40 If condition in templates
00:48:03 Using static files
00:53:39 Tasks App
00:58:29 For loop in templates
01:00:23 Adding tasks
01:02:39 Extending templates
01:09:45 Namespace Colision
01:14:22 CSRF verification
01:19:30 Django Forms
01:24:32 Form Validation
01:29:15 Django Redirect
01:31:09 Sessions
Not all capes wear heroes
@@johnjohn___ 😂wha-
You might learn to code from anywhere but if you really want to clear your concepts about what really is happening.. CS50 is a must
Are you referring to cs50x?
@@ObaidahNaseer yeah
Yep. I did 3 weeks of CS50x and it carried me through my first 2 years of coding in college. Coming back now many years later to try web dev
1:11:53 - names collision
1:14:40 - CSRF verification failed
1:19:30 - Django's own ability to create forms
1:29:15 - Django redirect
#pointstolookup
Mr Brian is a Brillant teacher and the build up of the lesson apps is awesome,No wonder they produce whole new level of brillant pass out students with the teaching faculty and clarity of subject like this.Thank you so much Harvard and the biggest gift of our time " The internet".
Just give him some water for God sake!
Great job dude. It is really what I need.
This is way better than paid courses from Udemy. I don't know why I wasted so much money on rubbish courses when I could've just taken this course.
never pay for a course when you can find it for free
The best things in life are free lol
@@lemon_maho The thing is, for a long time there were no courses like this for free.
A very dense and totally meaningful course! Instead of wasting time on nonsense coding bootcamps (html, css, python and Django) here you see the total pure logic background and create totally generic pages, submit buttons that does something and things changes according to input... I loved and each 5 mins or so wanted to press on the like button (first time ever) :)))
Brian should have his own software development learning startup and expand the content not covered on cs50! He'll give a real treasure to this world and earn 100 of millions if not billions doing so!
Brian is the best online teacher for me. i connect with his way of teaching so much that i understand everything he teaches so easily. i don't think i've enough words to thank him for this. God bless Brian
This is the best lecture I have taken on Django
Thank you CS50 for posting this super useful lecture! Brian has excellent delivery skills.
We need more teachers like him !
Around 25 min, when you already have dedicated views for Brian and David then I think you should prioritize them in first and the generic greet view comes later only in defining URLs paths. This is not an error but makes different logical outputs.
I am really thankful for your teaching.
Could you explain what you mean by different logical outputs? Transforming UA-cam into stackoverflow I know :D
Omfg such good teacher, never stops, always knows what to say, tempo is just perfect, everything is so clear and you can easly follow along, congrats
Thank you for this!!! Brian and David are amazing teachers!!
It is such a hard work to squeeze so much information into a short video like this
I was procrastinating while learning Django alot nothing new always happens to me , I was learning by Dj docs tuned this course on I have been studying for like 4-5 hrs now Brian got me hooked mann literally I wish i had a ai bot like brian that explained me everything i needed to know in my life
:0 brian ai...
Check his ai course 😂
wow! what an energy and a teacher. Thanks for this great teaching.
Wow!
The pedagogy in this course is brilliant.
Congrats and thank you!
This is the Best django course on the net. I advise anyone searching a good djanho course to focus on this.
This video is awesome. Clears so many concepts about Django without being overwhelming.
Great delivery of content by one of the best Software Engineers. Looking forward to the next lecture.
Sir brine
You're ture is nice my parents worked as teachers in high school. Your lecturs very marvelous.
Thank-you
From
Kaladhar murakond
best web programming course all over the world
Open class and no hidden points keeping within paid class.
Thank you.
When student is ready teacher will emerge, no need spend lot of money when we have this kind of courses
This is so powerful. There is nothing else you need to conquer the world (other than some cash runway to keep your experiment alive)
my university is offering the course in pkr 20000 and he is for free and no words for his teaching thanks a lot sir
Really great lecture. Feel like this video covers so much ground without ever getting too overwhelming.
31:28 render(request ,html page,context)
37:01 newyear app
43:36 python logic
48:00 static file
01:13:13 the info is posted to the same page we are in
01:34:00 no such table . error
Thank you so much for making this wonderful lecture free! I learnt a lot from this course
cs50 is doing a great job for common people
This course seems like perfect!
1:31 was the purest use of incognito I've ever seen.
1:31:30 *
Another great lecture. Thanks for making these available.
Thank you, bro. I was struggling with getting into Django for like two weeks. You made it easy!
You fill the gaps I had, such an amazing teacher, now I can read the rest with more confidence, thanks
i got it very well and i really appreciated and how you guy make it clearly that anybody can understand
Thanks for the Tutorial. You have clarified some issues with limited time available.
Thanks to Dr Malan, Jordan Hayashi and Brian Yu i have my own programming channel. Ive started in CS50 earlier than that like 9 years ago
estou aplaudindo esse curso com os pés porque com as mãos estou programando
1:18:38 where the madness is started 😵💫
literally from here the challenging part starts
Thank you from the bottom of my heart Brain. May God bless you 🙏
brain is brilliant , and I have really enjoyed the lecture, thanks buddy, your are doing great job
I finally understood what the csrf token does! That aside, great lecture, thank you!
46:07 The smoothest bug fix I have ever seen
I suppose the collision error, 1:10:08, was somewhat intentional to explain the next steps in those cases.
But in this part 54:07 you can look at settings.py tasks is added at the end (after newyear) and at 54:13 urls.py tasks/ is NOT added at the end but before newyear/, hence the error.
* I put tasks in both cases (settings.py and urls.py) after newyear and there was no error.
good observation
I wish Brian has his own UA-cam Channel! He is the best CS professor I have learnt from.
Indeed he has a channel ua-cam.com/channels/DzVUXiTr3hClI-zzCWbYzg.html
Dang! This video was made back in January, but they uploaded this two months later.
This is...so much information.
Thank you CS50 for this lecture. Great job Brian and David.
There's a minimal logical error at the end since the "request.session[tasks]" only creates if the user goes first to the url "/tasks/", however if the user goes first to the url "/tasks/add" , the "request.session[tasks] is not created, so if the user tries to add a new task, it won't work.
just a little observation, it was a great lecture
its working though
Yes, but add in def add(request):
if "tasks" not in request.session:
request.session["tasks"]=[]
and this work fine! (if the user goes first to the url "/tasks/add")
How can he just do a lecture for nearly 2 hours straight with so much energy. I would fall asleep in the first 5 mins if I was him. Anyway I learnt alot from this lecture
Amazing Presentation. A real pleasure to follow this young and skilled instructor .
- Thanks
I usually skip long videos but this thisss was totally worth it. a 1000 blessings to you. also whoever was in charge of the camera movements blew my mind.
its automatic tracking
Thank you as always for the clear succinct lecture!
This guy is just too good
You're an excellent teacher, thank you!
This is amazing content and very high quality... Love it alot ...Just came for the Django portion.
Amazing teacher
great tutorial for web dev starters
Really thanks, Harvard.
Great Lecture Brian Yu!
36:09 - Me watching this tutorial on Christmas day!
Lol, I missed this opportunity
36:58 this one i can use😂😂
I can’t believe this is all for free
This. Looks. Powerful. Man I need to master it.
1:25:28 what determines if a form is valid or invalid? valid according to what criteria? and what is "cleaned_data"? Was that ever explained?
at 1:36:17 when Brian changes the add function to, instead of updating the (deleted) global variable, update the task list in the session - why are we using this syntax += [task] ?
I know that the += is shorthand for append, but why is 'task' , that is obtained from the cleaned_data of the form and is a string, not simply appended to request.session["tasks"]] which is a list via the .append() method?
If I use request.session["tasks"].append(task) it doesn't work.
I'm trying to understand why.....
request.session["tasks"] = a list
task = a string
I should be able to use the append method on the list to append the string. I'm clearly missing something here.
Anyone that can explain this?
Made a stackoverflow question for this because it was bugging me and in the video Brian just 'acts like this is normal syntax' :)
stackoverflow.com/questions/63449525/append-to-request-sessionslist-in-django/63477092#63477092
Hi, Because i python u cant add one item in list with +=. you must add it to list with append function.
hey, when you use .append() the session by default won't be saved. Documentation here: docs.djangoproject.com/en/2.2/topics/http/sessions/#when-sessions-are-saved
I'm not sure, but it seems the syntax Brian used gets around that and forces Django to save the session without having to explicitly say: request.session.modified = True.
@@honoriuszbalzak thank you, that was helpful.
@@honoriuszbalzak Thanks
Best of the best work
Thank you Brian, you are such a great teacher!
million times better than udemy crabs.
Simply Amazing.
Excellent course and good teacher, keep like that. It "1hr" lecture but its really 3hs if you want to follow his peace..Thanks for the Free course.
thank for valuble series
God bless you.
thank you for the great content. I learned a lot it from you
At 1:36:36 why does he use the += operator instead of using .append()? couldn't he just use .append() again? Was there a reason for this?
hey, when you use .append() the session by default won't be saved. Documentation here: docs.djangoproject.com/en/2.2/topics/http/sessions/#when-sessions-are-saved
I'm not sure, but it seems the syntax Brian used gets around that and forces Django to save the session without having to explicitly say: request.session.modified = True.
I take it as: CurrentTask + NewTasks = NewTasks(updated)
append(): This does not work request.session["tasks"].append(task)
but this work
list_tmp = request.session["tasks"]
list_tmp.append(task)
request.session["tasks"] = list_tmp
: )
@@freelanceprogrammer9537 Thank you!
Great lesson! Thanks for sharing with us :)
Thanks! Helped a lot.
5:45
10:40
11:43
12:35
14:22
17:20
24:05
Great explanation, thank you Brian and David!
@ 51:00 you need to write {% load static %} above the css link to get it working on the actual version of django.
1:36:25 why it doesn't work if we utilize append like this??? request.session["tasks"].append(task), it only works if we write request.session["tasks"] += [task]
How do you add CSS to the html template? I can't seem to be able to add it
Brian & david u are my heart Beat=true:
Thank you a million
This was a cool lesson. Good stuff.
Thank you for your efforts very helpful video
But what if you have a layout that's common across all your applications, where do you put it?
How can we add CSS (styling based on id or class) to the HTML input fields generated by django
Good question. I found this: tutorial.djangogirls.org/en/css/
By adding a static files in settings.py
the best way is to use dev tools in your browser and check the input fields and then grab predefined attributes.
this works for me......very well.....
but if you want use django thing use django widgets to set attributes first then use them in your css
merci beaucoup tu es le meilleur
this went from 0 to 100 and Brian says we just scratched the surface of Django
Oh they actually review your code in this web course :0 now i am anxious 😰😰😰
I'm completely lost, couldn't follow along the Django installation and all the commands. I'm using Windows and wish to set up VS Code to use the terminal but i haven't found any useful docs / tutorial regarding the set up. Can anyone help?
On youtube I followed a tutorial from a guy named Tubemint for a python and django setup on windows. From there I installed vscode, and once I had python and django running I created my project and went to the cmd window and typed code . (remember there is a space and a period after code) which automatically opened my project on vs code. You can even open up the project folder on vs code and it will show every file for the project that way as well.
here is an exemple can help you
code.visualstudio.com/docs/python/tutorial-django
If you're on Windows I would highly recommend installing a bash environment program like Git Bash (included in Git for Windows) or Windows Subsystem for Linux. The commands that Brian uses in his zsh shell can be done verbatim in your bash shell.
@@bvedantcodes That will create a nightmare of PATH issues for noobs just starting out.
When I run the python manage.py runserver the second time after we create the app hello it shows a error. Please HELP
make sure the hello app is added in the settings.py
copy paste my code in views.py and it will work:
from http.client import HTTPResponse
from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
def index(request):
return HttpResponse("Hello, world!")
1:10:14 - mine actually worked and didn't go to 'No' as yours did. Did I just get lucky? Does Django truly randomly decide which .html file to open?
I had the same result and did some experimenting. It is certainly not random.
Django seems to look in in the 'last url in the project's urlpatterns list' first. (lecture3/urls.py)
In your lecture3 project 'urls.py', if you change the list as follows:
urlpatterns = [
path('admin/', admin.site.urls),
path('tasks/', include("tasks.urls")),
path('newyear/', include("newyear.urls")),
path('hello/', include("hello.urls")),
]
so that 'hello' is last (recall that the hello APP also has a path with a name of 'index').
If you would now link to url 'index' - django will always go the index url of the hello APP.
As you can see at 54:10 , Brian (probably on purpose to drive his point home later) puts the path for tasks BEFORE the newyear path in the urlpatterns list.
You and I added it to the end of the list and as such we did not produce this problem.
Having said all of that - it is good practice to name your apps so you can explicitly link to them.
@@zerodivided3676 Thank you, you were smart!
@@zerodivided3676 People are so smart at debugging, I hope that I'll be like you someday