1
00:00:05,370 --> 00:00:09,090
Welcome back, everyone, to this section of the course on class-based views.

2
00:00:10,120 --> 00:00:14,560
So far, we've actually only seen functions inside our reviews that profile.

3
00:00:14,860 --> 00:00:20,980
But just like forms and models, Django provides an entire view class system that is very powerful for

4
00:00:20,980 --> 00:00:22,960
quickly rendering commonly used views.

5
00:00:23,440 --> 00:00:28,690
Let's go ahead and see Django developers own reasoning from the documentation on why to use class-based

6
00:00:28,690 --> 00:00:29,050
views.

7
00:00:30,040 --> 00:00:35,740
So from the documentation, Django developers say the following writing Web applications can be monotonous

8
00:00:35,740 --> 00:00:41,170
because we repeat certain patterns again and again, Django tries to take away some of that monotony

9
00:00:41,170 --> 00:00:42,640
at the model and template layers.

10
00:00:42,940 --> 00:00:46,120
But web developers also experience this boredom at the view level.

11
00:00:46,510 --> 00:00:48,070
And let's take a moment to think about that.

12
00:00:48,490 --> 00:00:51,880
Are there going to be function based views that you use over and over again?

13
00:00:52,210 --> 00:00:57,250
Well, certainly if you have a model, you're probably going to have views like creating a new instance

14
00:00:57,250 --> 00:01:03,730
in that model or listing all the instances of that model or deleting or updating based on the view side

15
00:01:03,730 --> 00:01:04,150
of things.

16
00:01:04,390 --> 00:01:06,490
Those are going to be commonly used tasks.

17
00:01:06,730 --> 00:01:13,450
So in that case, Django has views that in a class based form can automatically create those connections

18
00:01:13,450 --> 00:01:13,900
for you.

19
00:01:15,220 --> 00:01:18,460
So jingles, generic views were developed to ease that pain.

20
00:01:18,910 --> 00:01:23,890
They take certain common idioms and patterns found in viewed development and obstruct them so that you

21
00:01:23,890 --> 00:01:27,550
can quickly write common views of data without having to write too much code.

22
00:01:27,950 --> 00:01:31,150
That's really where the class based views strength comes from.

23
00:01:31,150 --> 00:01:38,320
These generic views that you can easily use to just in a few lines of code, connect a model to a template.

24
00:01:39,730 --> 00:01:45,130
So again, Django CPB's or class based views come with many pre-built generic class views for common

25
00:01:45,130 --> 00:01:48,460
tasks, such as listing all the values for a particular model in a database.

26
00:01:48,760 --> 00:01:50,740
This, in particular, is known as the list of you.

27
00:01:51,070 --> 00:01:55,030
Or maybe you want to create a new instance of a model object that's known as a create view.

28
00:01:56,320 --> 00:02:00,730
So once we cover the basics of class based views, we're going to go through a quote unquote tour of

29
00:02:00,730 --> 00:02:05,320
the key generic class based views and cover the few specifics that are important to know when using

30
00:02:05,320 --> 00:02:07,270
them as a quick note.

31
00:02:07,300 --> 00:02:10,419
They should be relatively easy to use to understand on their own.

32
00:02:10,479 --> 00:02:16,060
So towards the end of this section, to be fully honest, it's going to feel maybe slightly repetitive

33
00:02:16,060 --> 00:02:18,910
because the class space views are really easy to use.

34
00:02:19,090 --> 00:02:20,620
Once you understand how they work.

35
00:02:20,740 --> 00:02:25,330
So the very last few lectures, we're going to go quite quickly through those views because they pretty

36
00:02:25,330 --> 00:02:26,440
much explain themselves.

37
00:02:27,400 --> 00:02:31,240
So we're going to do here is we're going to talk about the very basics of class space views and then

38
00:02:31,240 --> 00:02:34,840
we're going to go give you a tour of generic views, starting with a template view.

39
00:02:35,110 --> 00:02:38,560
That is, just how do I connect a template to a view, to a URL?

40
00:02:38,980 --> 00:02:43,450
Then we'll talk about list of views, detailed views, great views and elite views, as well as a few

41
00:02:43,450 --> 00:02:45,760
other ones like update views and form views.

42
00:02:46,210 --> 00:02:47,890
OK, let's get started.

43
00:02:48,160 --> 00:02:49,120
I'll see you at the next lecture.

