File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
en/extend_your_application Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -99,13 +99,17 @@ Ok, time to add a *view* to our `views.py` file!
99
99
100
100
We should open ` blog/views.py ` and add the following code:
101
101
102
- from django.shortcuts import render, get_object_or_404
102
+ ``` python
103
+ from django.shortcuts import render, get_object_or_404
104
+ ```
103
105
104
106
Near other ` from ` lines. And at the end of the file we will add our * view* :
105
107
106
- def post_detail(request, pk):
107
- post = get_object_or_404(Post, pk=pk)
108
- return render(request, 'blog/post_detail.html', {'post': post})
108
+ ``` python
109
+ def post_detail (request , pk ):
110
+ post = get_object_or_404(Post, pk = pk)
111
+ return render(request, ' blog/post_detail.html' , {' post' : post})
112
+ ```
109
113
110
114
Yes. It is time to refresh the page: http://127.0.0.1:8000/
111
115
You can’t perform that action at this time.
0 commit comments