1
00:00:05,270 --> 00:00:06,290
Welcome back.

2
00:00:06,290 --> 00:00:09,330
Now that we set up the form to create a blog post we'll move on.

3
00:00:09,350 --> 00:00:16,000
Creating the views you want to create a view to create a blog post as well as a blog post view to update

4
00:00:16,070 --> 00:00:18,280
a blog post or delete a blog post.

5
00:00:18,500 --> 00:00:23,300
And then finally one view that actually just shows a singular blog post so you can think of these as

6
00:00:23,360 --> 00:00:29,760
a create view and update view delete view and then just say normal show or just view of you if you will.

7
00:00:29,970 --> 00:00:31,520
OK let's get started.

8
00:00:31,550 --> 00:00:32,680
OK so we're back here.

9
00:00:32,680 --> 00:00:35,630
This is the forums that py file we created in the previous lecture.

10
00:00:35,630 --> 00:00:36,280
Pretty short.

11
00:00:36,310 --> 00:00:40,350
The couple of lines of code we're going to go to our views up high.

12
00:00:40,550 --> 00:00:47,330
So remember this is under blog posts forward slash views PI and we'll be creating the views here.

13
00:00:47,330 --> 00:00:49,940
First we're gonna have to do a couple of imports.

14
00:00:50,030 --> 00:00:57,240
Say from flask import we're going to render a template you Earl for if you want to flash the messages

15
00:00:57,250 --> 00:00:58,410
you can say flash.

16
00:00:58,630 --> 00:01:04,650
And then we'll also have request redirect and then blueprints.

17
00:01:04,660 --> 00:01:07,050
OK so a bunch of imports from basic flask.

18
00:01:07,150 --> 00:01:10,660
We're also going to need to make sure that someone's logged in if they want to edit or update their

19
00:01:11,080 --> 00:01:19,990
blog posts so we'll say from flask log in import current user and the log in required decorator.

20
00:01:19,990 --> 00:01:25,030
Then from that we'll just import a couple of things from our actual puppy company blog.

21
00:01:25,030 --> 00:01:32,210
So say from puppy company blog import and we're going to import D-B.

22
00:01:32,230 --> 00:01:38,140
So the actual database so it can actually save and commit our changes to blog post and we'll will say

23
00:01:38,140 --> 00:01:42,090
from puppy company blog models import.

24
00:01:42,310 --> 00:01:44,840
And we'll just be editing models based on the blog post.

25
00:01:44,840 --> 00:01:52,460
We don't need to actually deal users here then from Papy company blog the blog posts forms.

26
00:01:52,660 --> 00:01:56,660
We're going to import the form we just created which was the blog post forum.

27
00:01:57,250 --> 00:02:01,810
And then finally let's actually register this entire set of views as a blueprint.

28
00:02:01,810 --> 00:02:12,760
So I'll say blog posts equal to blueprints where we say blog posts and then passen name here and now

29
00:02:12,760 --> 00:02:17,320
that we've actually have this blueprint Let's go ahead and just jump forward to registering it will

30
00:02:17,350 --> 00:02:19,470
come in at that pie remember we.

31
00:02:19,540 --> 00:02:24,220
If we scroll the way down to bottom we kind of have all these imports organized here so I'll do here

32
00:02:24,220 --> 00:02:33,610
is we'll just say from puppie company blog stop blog posts views import and we call this blog posts

33
00:02:33,730 --> 00:02:35,450
and then we'll just register it.

34
00:02:35,500 --> 00:02:42,510
So say take her up and register the blog posts views.

35
00:02:42,810 --> 00:02:44,940
OK so that blueprint is now registered.

36
00:02:44,950 --> 00:02:48,660
So we'll come back to use that pie and the collapse some of these tabs here.

37
00:02:48,660 --> 00:02:50,630
So we get as much space as possible.

38
00:02:50,740 --> 00:02:52,880
And let's set up our views.

39
00:02:52,990 --> 00:02:58,030
So first comments out which ones we want to do we want you for creating a blog post.

40
00:02:58,450 --> 00:03:03,070
We want just a simple view for like viewing a blog post so just showing up a single blog post there

41
00:03:03,910 --> 00:03:06,280
that we want to view for updating a blog post.

42
00:03:06,430 --> 00:03:09,260
And then we want a view for deleting a blog post.

43
00:03:09,280 --> 00:03:14,440
So there's always going to be kind of your basic crud sort of things create read up and delete.

44
00:03:14,560 --> 00:03:17,760
So you can think of this as create read up and delete.

45
00:03:17,800 --> 00:03:23,990
So start off with creating a new blog post so we'll say atts Let's do our routing here.

46
00:03:24,040 --> 00:03:28,510
Blog posts dot routes and we'll just call this forward slash.

47
00:03:28,550 --> 00:03:34,180
Well it's curious that right create that census will contain that form that we created earlier we'll

48
00:03:34,180 --> 00:03:43,150
see methods as equal to get and post and a person should be logged in to create a blog post.

49
00:03:43,190 --> 00:03:48,680
So I'll also attach the loggin required decorator to this particular view function and I'm going to

50
00:03:48,680 --> 00:03:57,280
just call this create post and then we'll say form is equal to the blog post form that we created earlier.

51
00:03:57,280 --> 00:04:01,770
So blog post form and now we have an instance of that form.

52
00:04:01,820 --> 00:04:04,210
Let's give ourselves a couple more lines of space here.

53
00:04:04,520 --> 00:04:10,410
So upon creating that form if that form is valid on submit.

54
00:04:10,580 --> 00:04:12,700
So that means they submitted the form and it's valid.

55
00:04:12,740 --> 00:04:14,940
We'll create a new instance of a blog post.

56
00:04:15,140 --> 00:04:22,400
So I'm just going to say that the blog post is equal to an instance of a blog post with the title equal

57
00:04:22,400 --> 00:04:30,650
to the title provided in that form and then we'll also say that the text is equal to the form thought

58
00:04:30,710 --> 00:04:31,980
text data.

59
00:04:32,180 --> 00:04:37,700
And then finally we'll also want to make sure that we link this to a particular user ID so that was

60
00:04:37,730 --> 00:04:43,250
required if you go back to our models up-I file that's in the in it for a blog post.

61
00:04:43,460 --> 00:04:48,580
So say user ID is equal to the current logged in user.

62
00:04:48,800 --> 00:04:50,330
And then we'll just grab their ID.

63
00:04:50,450 --> 00:04:55,460
So we have to make sure that these two are coming from the form and so user ID is coming from the currently

64
00:04:55,460 --> 00:04:59,320
logged in user since our form does ask the user for their ID.

65
00:04:59,360 --> 00:05:02,810
Once you created that instance of the blog post now we just save it toward the database.

66
00:05:02,840 --> 00:05:07,960
So say take our D-B session and then add the blog post.

67
00:05:07,960 --> 00:05:09,300
So you just created.

68
00:05:09,450 --> 00:05:11,450
Go ahead and commit those changes.

69
00:05:11,450 --> 00:05:17,850
So SATB session commits and if you want you can flash some message if you decide to stay on the same

70
00:05:17,850 --> 00:05:18,490
page.

71
00:05:18,840 --> 00:05:23,750
So you could say blog post created and often will people like you as the beginning testing apps.

72
00:05:23,850 --> 00:05:27,540
They sometimes sort of flash and this will just print it out so you can check your command line to see

73
00:05:27,540 --> 00:05:28,770
if things are working.

74
00:05:29,890 --> 00:05:31,570
And then we'll just return.

75
00:05:31,570 --> 00:05:33,280
In this case we're going to redirect.

76
00:05:33,400 --> 00:05:35,140
And you can redirect wherever you want.

77
00:05:35,230 --> 00:05:39,810
After you've created a blog post in our case we'll just redirect them back to the home page.

78
00:05:39,820 --> 00:05:46,180
So saying go back to our core index page Now that's if they've actually submitted the form room or we

79
00:05:46,180 --> 00:05:51,160
want to have a basic return render template for the very first thing that's going to show up in this

80
00:05:51,160 --> 00:05:58,350
case we'll go ahead and say create posts the H team L and we'll pass in that form equal to form.

81
00:05:58,510 --> 00:06:02,740
So we're going to end up later on creating a template for a creating a post for him.

82
00:06:02,740 --> 00:06:05,950
Let's go ahead to just create that template right now as far as the actual file.

83
00:06:05,950 --> 00:06:06,820
So we don't forget.

84
00:06:07,090 --> 00:06:11,730
So underneath templates all say new file create underscore.

85
00:06:11,740 --> 00:06:13,970
Post each team L.

86
00:06:14,300 --> 00:06:14,840
OK.

87
00:06:15,010 --> 00:06:16,290
So I had that Tim.

88
00:06:16,330 --> 00:06:17,710
I'll fill that out later.

89
00:06:18,190 --> 00:06:19,620
So I've done the create.

90
00:06:19,660 --> 00:06:24,020
Now it's time to actually do kind of the read or view of a single blog post.

91
00:06:24,220 --> 00:06:25,930
So how can we do this.

92
00:06:25,930 --> 00:06:30,270
This one we actually don't need to worry if someone's logged in or not.

93
00:06:30,310 --> 00:06:35,860
So we're going to say as blog posts that route and we're going to use a numbering system because remember

94
00:06:36,130 --> 00:06:39,900
every single blog post has a unique ID integer identifier.

95
00:06:40,000 --> 00:06:46,300
So all we can to say is the following blog post ID.

96
00:06:46,620 --> 00:06:48,590
And remember we're going to pass this in.

97
00:06:48,630 --> 00:06:53,580
So essentially someone can go to your Web site go forward slash and then put the blog post ID and they

98
00:06:53,580 --> 00:06:57,990
will be able to find that actual viewing of that single blog post.

99
00:06:57,990 --> 00:07:02,790
Now to make sure that this is going to be treated as an integer within our function what we're going

100
00:07:02,790 --> 00:07:07,120
to do is one last thing we're going to say I enty colon.

101
00:07:07,380 --> 00:07:12,540
And what that does is it makes sure that when someone provides this blog post and we actually use it

102
00:07:12,630 --> 00:07:16,860
instead of a function that we treat it as an integer instead of a string.

103
00:07:16,860 --> 00:07:18,020
You'll see why that's important.

104
00:07:18,090 --> 00:07:23,540
And just the second going to create my view of what I should call it blog posts since we're just reading

105
00:07:23,540 --> 00:07:31,280
a blog post and we're going to take in our blog post ID so remember that's the actual ID that's being

106
00:07:31,280 --> 00:07:32,590
passed in here.

107
00:07:34,170 --> 00:07:40,620
And then we'll say blog post is equal to and then we're just going to query our table.

108
00:07:40,620 --> 00:07:48,380
So I'll say get underscore or 4 0 4 for that blog post ID.

109
00:07:48,720 --> 00:07:53,600
So this is the main reason right here why we're passing in this I and.

110
00:07:53,940 --> 00:07:55,500
Basically it's kind of a qualifier.

111
00:07:55,710 --> 00:08:01,650
So if you didn't have this eye and see what could happen is it thinks that this blog post ID is a string.

112
00:08:01,830 --> 00:08:06,870
So then when you actually end up queering based off that blog post Id remember in the actual database

113
00:08:06,870 --> 00:08:09,630
or table that's an integer not a string.

114
00:08:09,690 --> 00:08:14,210
So it could get confused which is why we want to clarify that when we're passing this into this function.

115
00:08:14,430 --> 00:08:16,980
We want to make sure that it's cast as an integer.

116
00:08:17,010 --> 00:08:20,600
That way we can successfully query our blog post table.

117
00:08:21,330 --> 00:08:26,340
So once we've done that we're just going to return and we're going to render a template for viewing

118
00:08:26,490 --> 00:08:33,240
a single blog post and we'll just call that template blog post HVM L and woold passen.

119
00:08:33,300 --> 00:08:35,560
Let's say the title of the blog post.

120
00:08:35,760 --> 00:08:38,230
So say grab that blog post-Idol.

121
00:08:38,400 --> 00:08:40,450
And then also Passons some other things.

122
00:08:40,620 --> 00:08:42,190
Let's passen the date.

123
00:08:42,330 --> 00:08:44,670
So we're saying grab that blog post day.

124
00:08:45,210 --> 00:08:48,850
And then the post itself you can say blog post.

125
00:08:49,290 --> 00:08:53,670
It's up to you whether you want to pass in the blog post and grab those attributes in the template or

126
00:08:53,670 --> 00:08:55,310
if you pass them separately here.

127
00:08:55,530 --> 00:09:00,510
Personally since this has to do more of Python I like calling these attributes in the views but you

128
00:09:00,510 --> 00:09:02,970
could figure out a way to just do it all the template side.

129
00:09:03,000 --> 00:09:06,820
But this to me makes a little more sense that way when we actually reached the template.

130
00:09:06,930 --> 00:09:11,080
I get these nice variables title dates and post to play around with.

131
00:09:11,180 --> 00:09:12,770
OK so we're going to say that.

132
00:09:12,840 --> 00:09:18,000
And since we created this blog post each team l reference here and views let's quickly create that template

133
00:09:18,030 --> 00:09:20,270
as well just so we have it ready to go.

134
00:09:20,280 --> 00:09:25,750
So underneath templates all say new file and I'll create a blog post.

135
00:09:25,800 --> 00:09:26,490
H Teano.

136
00:09:26,520 --> 00:09:29,040
So that is something we're going to fill out later.

137
00:09:29,190 --> 00:09:30,780
So we have two views down.

138
00:09:30,780 --> 00:09:35,190
Last two we want to do is an update to a blog post and delete to a blog post.

139
00:09:35,190 --> 00:09:37,590
So let's get this going.

140
00:09:37,590 --> 00:09:42,300
The one that's actually going to look really similar to the create as you may have guessed we'll say

141
00:09:42,330 --> 00:09:46,270
blog post route and we're going to route.

142
00:09:46,320 --> 00:09:50,220
Now we're actually going to be using the same sort of integer technique we did earlier to make sure

143
00:09:50,220 --> 00:09:55,620
that when we look up this blog posts and or update it we're looking it up as a integer.

144
00:09:55,640 --> 00:10:05,980
So say grab that blog post and then go to update and we'll say methods is equal to gets and post because

145
00:10:05,980 --> 00:10:10,330
there is going to be a form on this page for updating this and we should also make sure that the person

146
00:10:10,330 --> 00:10:11,720
is logged in.

147
00:10:12,040 --> 00:10:22,210
So we're going to say log in required and they all say the update blog post ID and we're going to do

148
00:10:22,210 --> 00:10:23,440
a couple of things here.

149
00:10:23,560 --> 00:10:28,100
We don't want anyone to be able to edit or update anyone else's blog posts.

150
00:10:28,150 --> 00:10:33,940
So we want to make sure that when we actually query this blog post immediately after that we make sure

151
00:10:34,030 --> 00:10:37,320
that the current author is equal to the current user.

152
00:10:37,330 --> 00:10:39,080
So let's show you how we could do that.

153
00:10:39,280 --> 00:10:44,920
First let's actually grab the blog post that was requested in the Yoro will do that simply by essentially

154
00:10:44,920 --> 00:10:51,420
copying and pasting what we did up here which was blocked post queery get 404 get blog posts.

155
00:10:51,580 --> 00:10:53,360
That's actually the exact same command.

156
00:10:53,500 --> 00:10:54,700
We're going to have here.

157
00:10:54,760 --> 00:11:01,450
So someone's going to go to this ID number go forward slash update and then we will query for them whether

158
00:11:01,450 --> 00:11:06,620
or not that blog post exists will say either return or for or for or grab that blog post.

159
00:11:06,640 --> 00:11:13,030
Now we want to check to make sure that the person visiting this for the update is actually the author.

160
00:11:13,030 --> 00:11:23,020
So here we're going to say if Blog Post the author is not equal to the current user then I'm going to

161
00:11:23,020 --> 00:11:31,580
call abort 4 0 3 and this abort function is something that flask actually comes with which allows you

162
00:11:31,580 --> 00:11:38,720
to pasand common error codes so you could kind of forced abortions of like 4 0 4 4 0 3 4 10 or 500 internal

163
00:11:38,720 --> 00:11:39,680
servicer.

164
00:11:39,680 --> 00:11:42,740
In this case we're going to pass and 4 0 which means forbidden.

165
00:11:42,770 --> 00:11:45,880
That basically means they don't have access due to some permission issue.

166
00:11:45,980 --> 00:11:49,610
And in this case it's because they're not the actually the author so they shouldn't be updating that

167
00:11:49,610 --> 00:11:50,990
blog post.

168
00:11:50,990 --> 00:11:51,490
OK.

169
00:11:51,590 --> 00:11:56,340
Let's assume that everything went well there the actual author then will just create a form.

170
00:11:56,630 --> 00:12:02,600
So we'll create an instance of our blog posts form and then once that's done we're going to do the same

171
00:12:02,600 --> 00:12:04,500
thing that we did in our creed.

172
00:12:04,570 --> 00:12:06,350
So let's copy that code here.

173
00:12:06,350 --> 00:12:09,770
We're going to see if that form was valid on submission.

174
00:12:09,770 --> 00:12:18,290
We're going to pass in the form that title foreign text and the user id the session commit and then

175
00:12:18,470 --> 00:12:24,360
grab all this stuff so I to grab all this and we'll edit it just a little bit for the actual update.

176
00:12:25,100 --> 00:12:25,670
OK.

177
00:12:25,670 --> 00:12:28,560
So we decided they are the author.

178
00:12:28,640 --> 00:12:32,380
They've created a blog post for it the form is valid on Submit.

179
00:12:32,390 --> 00:12:36,920
Well we're going to do is instead of creating a brand new blog post we're just going to set the current

180
00:12:36,920 --> 00:12:41,170
blog posts we grab and reassign those attributes to the form data.

181
00:12:41,270 --> 00:12:44,630
So instead of creating that we're going to do is say the following.

182
00:12:46,100 --> 00:12:55,430
We'll say that blog post its title is going to be equal to the form titled out data and that blog post

183
00:12:56,910 --> 00:13:03,540
its text is going to be equal to now the format text data we already know who the current user ID is

184
00:13:03,630 --> 00:13:06,080
so we can go ahead and just close that.

185
00:13:06,210 --> 00:13:07,880
We don't need to add anything.

186
00:13:07,890 --> 00:13:14,430
We just need to commit because it's an update and then we can say well is that a blog post created blog

187
00:13:14,430 --> 00:13:17,080
post updated.

188
00:13:17,370 --> 00:13:21,750
And it's kind of up to you where you want to redirect after this what we'll do is we're going to redirect

189
00:13:21,750 --> 00:13:25,570
to the actual particular blog post where they can see the update complete.

190
00:13:25,890 --> 00:13:29,620
So say you're all for blog posts.

191
00:13:29,960 --> 00:13:31,670
The blog post.

192
00:13:31,770 --> 00:13:37,230
So that's essentially the view that we created earlier and then we want to actually make sure we go

193
00:13:37,230 --> 00:13:39,870
to the right blog post when you provide the ID.

194
00:13:40,000 --> 00:13:48,000
So say blog post ID is equal to the blog post thought Id.

195
00:13:48,200 --> 00:13:53,520
OK so let's kind of break down what we just did here and zoom out so we can kind of see the whole picture.

196
00:13:53,540 --> 00:13:57,960
Basically what we're saying is if someone wants to update a blog we go ahead and grab that blog.

197
00:13:58,030 --> 00:14:00,110
Return of four or four if it doesn't exist.

198
00:14:00,260 --> 00:14:04,640
If it does exist then we move on and check that the current user was the actual author.

199
00:14:04,640 --> 00:14:07,320
If not we're going to abort with a permission issue.

200
00:14:07,400 --> 00:14:10,430
So if everything went well then they can fill out that update form.

201
00:14:10,430 --> 00:14:17,510
So the blog post form and then we're just going to reset the title to the title and that form will reset

202
00:14:17,510 --> 00:14:19,340
the text to the text in that form.

203
00:14:19,520 --> 00:14:26,210
Will any changes flash that it was updated and then redirect them to the new View which was essentially

204
00:14:26,240 --> 00:14:27,230
this view right here.

205
00:14:27,320 --> 00:14:33,200
This blog post view member that blog post it takes and this blog post ID which is why we're passing

206
00:14:33,290 --> 00:14:34,670
this in here.

207
00:14:34,790 --> 00:14:39,560
Now if we just have this by itself what's going to happen is when someone views and wants to update

208
00:14:39,920 --> 00:14:44,120
their actual blog posts they'll start off with an empty title an empty text.

209
00:14:44,150 --> 00:14:45,900
So that's not really much of an update.

210
00:14:45,920 --> 00:14:48,350
It's more of like rewriting the entire thing.

211
00:14:48,440 --> 00:14:54,230
So we want to make sure is when they first view this update page the original title and original text

212
00:14:54,320 --> 00:14:57,700
is already been pre-filled out in the form for them.

213
00:14:57,700 --> 00:15:05,160
So the way we do that the will say Elif request method is equal to get.

214
00:15:05,210 --> 00:15:07,420
So they haven't actually posted yet.

215
00:15:07,520 --> 00:15:08,450
Then will do the following.

216
00:15:08,450 --> 00:15:13,550
We'll kind of do the reverse of what we did in Lyons 56 and 57 there we'll say go ahead and grab the

217
00:15:13,550 --> 00:15:24,560
form and say it's title data equal to the blog post title and set the form's text data equal to the

218
00:15:24,560 --> 00:15:25,660
block post.

219
00:15:26,700 --> 00:15:34,660
Text and then finally we're going to return render a template and we'll have the Create post.

220
00:15:34,710 --> 00:15:46,760
H t m l will say tidal is updating form is for and if you want you can have a legend here or not.

221
00:15:46,770 --> 00:15:49,100
So it's up to you really what you want to pass back.

222
00:15:49,260 --> 00:15:54,880
But really what we need to pass back is the forum and we can update the title of the actual age as well.

223
00:15:56,190 --> 00:16:02,120
This means we have one last view to create which is our view essentially deleting a blog post.

224
00:16:02,160 --> 00:16:07,650
So for this is also going to be pretty straightforward and in fact I'm going to just copy and paste

225
00:16:07,950 --> 00:16:11,620
from what we did up here because instead of updating it we're just leading it.

226
00:16:11,640 --> 00:16:19,050
So the log in to also be required will want to make sure that instead of update we just call this delete

227
00:16:20,280 --> 00:16:32,260
and then we'll say DPF delete post pasand the blog post ID and then say a blog post is equal to blog

228
00:16:32,260 --> 00:16:33,270
posts.

229
00:16:33,290 --> 00:16:40,930
The query get or 4 or 4 pass in that blog post ID so really similar to what we did before.

230
00:16:40,930 --> 00:16:45,900
We also want to check that they have permission to delete this so same permission check as we just did

231
00:16:45,910 --> 00:16:51,230
for the update will say if the author isn't qualified we abort.

232
00:16:51,430 --> 00:17:01,410
So if not then we'll just say D-B session deletes and then will pass in that blog post so they'll actually

233
00:17:01,410 --> 00:17:05,400
remove the blog post and they will commit that deletion.

234
00:17:07,900 --> 00:17:12,560
And then we can flash the message saying blog posts deleted.

235
00:17:12,880 --> 00:17:17,350
So in our case depending on how we read their X work they may or may not see that flash and then we're

236
00:17:17,350 --> 00:17:20,500
going to see a return redirect.

237
00:17:20,830 --> 00:17:29,310
Let's redirect to and this case will go your for court thought index and save.

238
00:17:29,610 --> 00:17:37,050
OK something to notice here is I'm not actually going to connect this to a particular template instead.

239
00:17:37,070 --> 00:17:42,020
Later on when we're building out our templates we're going to learn about modals with bootstrap and

240
00:17:42,020 --> 00:17:45,360
that's going to have a nice little pop up button that they can choose to delete.

241
00:17:45,590 --> 00:17:50,240
So you can think of that almost as kind of a log out where a log out doesn't actually have a log out

242
00:17:50,240 --> 00:17:52,700
thought h T.M. that's directly connected to it.

243
00:17:52,720 --> 00:17:57,340
Instead it just initiates the view almost as like an action instead of an actual template.

244
00:17:57,500 --> 00:17:59,210
So delete is going to work the same way.

245
00:17:59,310 --> 00:18:01,000
There's not going to be a delete.

246
00:18:01,080 --> 00:18:02,050
H Tim L.

247
00:18:02,060 --> 00:18:07,310
Instead we have a button that executes all this deletion code.

248
00:18:07,310 --> 00:18:10,390
All right so we have our four views ready to go.

249
00:18:10,400 --> 00:18:13,330
Now we need to do is create the templates that connect them.

250
00:18:13,400 --> 00:18:15,010
So we've created our imports.

251
00:18:15,140 --> 00:18:16,910
We have a create view.

252
00:18:16,910 --> 00:18:18,070
Pretty straightforward here.

253
00:18:18,170 --> 00:18:20,640
Just pass in the form and then fill it out.

254
00:18:20,660 --> 00:18:22,630
Commit those changes.

255
00:18:22,670 --> 00:18:27,980
We have a view which is also pretty straightforward just grab that blog post and then render it in the

256
00:18:28,010 --> 00:18:28,720
template.

257
00:18:29,240 --> 00:18:30,390
Then we have an update.

258
00:18:30,390 --> 00:18:31,610
This a little more complicated.

259
00:18:31,610 --> 00:18:36,530
We have to make sure that the right author was viewing it and then we wanted to kind of pre fill in

260
00:18:36,530 --> 00:18:37,710
some information here.

261
00:18:37,850 --> 00:18:42,920
In the second part than for deleting we had essentially the same thing as an update except now we're

262
00:18:42,920 --> 00:18:46,570
just calling delete and we'll see why later on in the next lecture.

263
00:18:46,610 --> 00:18:48,440
This does have either rec template.

264
00:18:48,560 --> 00:18:53,500
Instead it will be kind of a delete button on The View blog post page.

265
00:18:53,510 --> 00:18:55,430
All right that's it for those views.

266
00:18:55,430 --> 00:18:57,220
Thanks and we'll see you at the next lecture.
