Skip to content

Commit d888ef9

Browse files
authored
Django Tute: session count matches what is displayed (#35423)
1 parent bdf066e commit d888ef9

File tree

1 file changed

+3
-5
lines changed
  • files/en-us/learn/server-side/django/sessions

1 file changed

+3
-5
lines changed

files/en-us/learn/server-side/django/sessions/index.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ This is a relatively simple example, but it does show how you can use the sessio
1414
<tr>
1515
<th scope="row">Prerequisites:</th>
1616
<td>
17-
Complete all previous tutorial topics, including <a
18-
href="/en-US/docs/Learn/Server-side/Django/Generic_views"
19-
>Django Tutorial Part 6: Generic list and detail views</a
20-
>
17+
Complete all previous tutorial topics, including <a href="/en-US/docs/Learn/Server-side/Django/Generic_views">Django Tutorial Part 6: Generic list and detail views</a>
2118
</td>
2219
</tr>
2320
<tr>
@@ -126,7 +123,8 @@ def index(request):
126123

127124
# Number of visits to this view, as counted in the session variable.
128125
num_visits = request.session.get('num_visits', 0)
129-
request.session['num_visits'] = num_visits + 1
126+
num_visits += 1
127+
request.session['num_visits'] = num_visits
130128

131129
context = {
132130
'num_books': num_books,

0 commit comments

Comments
 (0)