You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/django_views/README.md
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,14 +21,12 @@ Not too much stuff here yet.
21
21
22
22
Remember that lines starting with `#` are comments – this means that those lines won't be run by Python.
23
23
24
-
The simplest *view* can look like this:
24
+
Let's create a view as the comment suggests. Add the following minimal view below it:
25
25
26
26
{% filename %}blog/views.py{% endfilename %}
27
27
```python
28
-
from django.shortcuts import render
29
-
30
28
defpost_list(request):
31
-
return render(request, 'blog/post_list.html', {})
29
+
return render(request, 'blog/post_list.html')
32
30
```
33
31
34
32
As you can see, we created a function (`def`) called `post_list` that takes `request` and `return` a function `render` that will render (put together) our template `blog/post_list.html`.
0 commit comments