@@ -342,7 +342,6 @@ The notation is `{{ ... }}`, which displays the object as a string:
342
342
<input name="item_text" id="id_new_item" placeholder="Enter a to-do item" />
343
343
{% csrf_token %}
344
344
</form>
345
-
346
345
<table id="id_list_table">
347
346
<tr><td>{{ new_item_text }}</td></tr> <1>
348
347
</table>
@@ -351,11 +350,7 @@ The notation is `{{ ... }}`, which displays the object as a string:
351
350
====
352
351
353
352
<1> Here's our template variable.
354
- `new_item_text` will be the variable name for the user input we display in the template,
355
- to help distinguish it from `item_text`,
356
- which is the name of the form field which we use in the POST request.
357
- That will remind us that transforming the one into the other
358
- doesn't happen automatically; it's something we do ourselves in the view...
353
+ `new_item_text` will be the variable name for the user input we display in the template.
359
354
360
355
Let's adjust our unit test so that it checks whether we are still using the template:
361
356
@@ -685,7 +680,7 @@ other methods for your own purposes:
685
680
rows = table.find_elements(By.TAG_NAME, "tr")
686
681
self.assertIn(row_text, [row.text for row in rows])
687
682
688
- def test_can_start_a_list_and_retrieve_it_later (self):
683
+ def test_can_start_a_todo_list (self):
689
684
[...]
690
685
----
691
686
====
@@ -716,8 +711,7 @@ and the first test. Let's use it in the FT:
716
711
self.check_for_row_in_list_table("1: Buy peacock feathers")
717
712
self.check_for_row_in_list_table("2: Use peacock feathers to make a fly")
718
713
719
- # Edith wonders whether the site will remember her list. Then she sees
720
- [...]
714
+ # Satisfied, she goes back to sleep
721
715
----
722
716
====
723
717
@@ -1350,8 +1344,10 @@ def home_page(request):
1350
1344
{"new_item_text": request.POST.get("item_text", "")}, # <2>
1351
1345
)
1352
1346
----
1347
+ ====
1353
1348
1354
1349
<1> There's a quicker way to do these 3 lines with `.objects.create()`
1350
+
1355
1351
<2> This line doesn't seem quite right now, in fact it won't work at all.
1356
1352
Let's make a note on our scratchpad to sort out passing list items to the template.
1357
1353
It's actually closely related to "Display multiple items",
0 commit comments