Skip to content

Commit caf9c83

Browse files
committed
Merge pull request #330 from Matt-Deacalion/master
Conflating terms: POST (http method) vs Post (Django model)
2 parents 1948039 + 482c62f commit caf9c83

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

en/django_forms/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,13 @@ The answer is: nothing. We need to do a little bit more work in our *view*.
142142

143143
## Saving the form
144144

145-
Open `blog/views.py` once again. Currently all we have in `post_new` view is:
145+
Open `blog/views.py` once again. Currently all we have in the `post_new` view is:
146146

147147
def post_new(request):
148148
form = PostForm()
149149
return render(request, 'blog/post_edit.html', {'form': form})
150150

151-
When we submit the form, we are back in the same view, but this time we have some more data in `request`, more specifically in `request.POST`. Remember that in the HTML file our `<form>` definition had the variable `method="POST"`? All the fields from the form are now in `request.POST`. You should not rename `POST` to anything else (the only other valid value for `method` is `GET`, but we have no time to explain what the difference is).
151+
When we submit the form, we are brought back to the same view, but this time we have some more data in `request`, more specifically in `request.POST` (the naming has nothing to do with a blog "post", it's to do with the fact that we're "posting" data). Remember that in the HTML file our `<form>` definition had the variable `method="POST"`? All the fields from the form are now in `request.POST`. You should not rename `POST` to anything else (the only other valid value for `method` is `GET`, but we have no time to explain what the difference is).
152152

153153
So in our *view* we have two separate situations to handle. First: when we access the page for the first time and we want a blank form. Second: when we go back to the *view* with all form's data we just typed. So we need to add a condition (we will use `if` for that).
154154

0 commit comments

Comments
 (0)