From the course: Introduction to Django
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
Views - Django Tutorial
From the course: Introduction to Django
Views
- Okay, so let's start looking at views. And here's just a very simple view function that you could have. And it takes in a request and returns a response or HTTP request and HTTP response. So when a URL pass gets matched, then Django calls the corresponding view function. It passes in the request as well as any captured arguments from the URL. And the view function might return some HTML or JSON data or an exception page or other things like a file. You can also handle, GET and POST request differently and update or retrieve data from the database via models. And you can also require certain permissions from the user. So there's a lot of things that the view can be, the logic that can be in the view and the things that it manages and controls. But at the end of the day, it takes in a request and returns a response. An HTTP request will have a user attached to it as long as you're using some sort of middleware like the default Django auth middleware. And the user will just be an…
Contents
-
-
-
-
-
-
(Locked)
Django architecture10m 45s
-
(Locked)
Django project structures6m 55s
-
(Locked)
Example project overview7m 53s
-
(Locked)
Deployment settings16m 17s
-
(Locked)
Django ORM: Models10m 10s
-
(Locked)
Django ORM: Queries15m 39s
-
(Locked)
Django ORM: Migrations5m 19s
-
(Locked)
The user model7m 37s
-
(Locked)
URLs8m 50s
-
(Locked)
Views11m 20s
-
(Locked)
Class-based views3m 38s
-
(Locked)
Admin8m 19s
-
(Locked)
Front end5m 14s
-
(Locked)
Templates8m 7s
-
(Locked)
Forms8m 17s
-
(Locked)
-