Skip to content

Commit 5f7b695

Browse files
committed
fixes in chap 5 post and db
1 parent 9246713 commit 5f7b695

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

chapter_post_and_database.asciidoc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,7 @@ class Item:
864864
That gets our test as far as:
865865

866866
----
867+
[...]
867868
File "...goat-book/lists/tests.py", line 20, in
868869
test_saving_and_retrieving_items
869870
first_item.save()
@@ -1266,7 +1267,7 @@ the item in it, it should redirect back to the home page:
12661267
new_item = Item.objects.first()
12671268
self.assertEqual(new_item.text, "A new list item")
12681269
1269-
self.assertRedirects(response, "/") # <1>
1270+
self.assertRedirects(response, "/") # <1>
12701271
12711272
def test_only_saves_items_when_necessary(self):
12721273
[...]
@@ -1327,7 +1328,7 @@ We're at green, time for a little refactor!
13271328
Looking at views.py, there's a small change
13281329

13291330
[role="sourcecode currentcontents"]
1330-
.list/views.py
1331+
.lists/views.py
13311332
====
13321333
[source,python]
13331334
----
@@ -1504,9 +1505,9 @@ The Django template syntax has a tag for iterating through lists,
15041505
[source,html]
15051506
----
15061507
<table id="id_list_table">
1507-
{% for item in items %}
1508-
<tr><td>1: {{ item.text }}</td></tr>
1509-
{% endfor %}
1508+
{% for item in items %}
1509+
<tr><td>1: {{ item.text }}</td></tr>
1510+
{% endfor %}
15101511
</table>
15111512
----
15121513
====
@@ -1648,9 +1649,9 @@ Django template tag, `forloop.counter`, will help here:
16481649
====
16491650
[source,html]
16501651
----
1651-
{% for item in items %}
1652-
<tr><td>{{ forloop.counter }}: {{ item.text }}</td></tr>
1653-
{% endfor %}
1652+
{% for item in items %}
1653+
<tr><td>{{ forloop.counter }}: {{ item.text }}</td></tr>
1654+
{% endfor %}
16541655
----
16551656
====
16561657

@@ -1682,6 +1683,7 @@ Oh dear. It looks like previous runs of the test are leaving stuff lying around
16821683
in our database. In fact, if you run the tests again, you'll see it gets
16831684
worse:
16841685

1686+
[role="skipme"]
16851687
----
16861688
1: Buy peacock feathers
16871689
2: Use peacock feathers to make a fly

tests/test_chapter_post_and_database.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def test_listings_and_commands_and_output(self):
2222
self.assertEqual(type(self.listings[1]), CodeListing)
2323
self.assertEqual(type(self.listings[2]), Command)
2424

25-
print('\n'.join(str(t) for t in enumerate(self.listings)))
2625
views_pos = 18
2726
assert "def home_page" in self.listings[views_pos].contents
2827

@@ -34,9 +33,6 @@ def test_listings_and_commands_and_output(self):
3433
assert "migrate" in self.listings[migrate_pos]
3534
assert self.listings[migrate_pos].type == "interactive manage.py"
3635

37-
# skips
38-
# self.skip_with_check(86, "3: Buy peacock feathers")
39-
4036
self.start_with_checkout()
4137
self.start_dev_server()
4238
self.unset_PYTHONDONTWRITEBYTECODE()
@@ -61,7 +57,7 @@ def test_listings_and_commands_and_output(self):
6157
self.check_final_diff(
6258
ignore=[
6359
"moves",
64-
"Generated by Django 4.1",
60+
"Generated by Django 4.2.",
6561
]
6662
)
6763

0 commit comments

Comments
 (0)