@@ -1123,7 +1123,7 @@ to hold all the files related to login:
1123
1123
----
1124
1124
$ *cd src && python manage.py startapp accounts*
1125
1125
----
1126
- //ch18l021
1126
+ //ch19l021
1127
1127
1128
1128
// TODO: some output?
1129
1129
// DAVID: probably a good idea to `cd ..` after this command.
@@ -1188,7 +1188,7 @@ And now let's add add a _test_models.py_ to say:
1188
1188
1189
1189
1190
1190
[role="sourcecode"]
1191
- .src/accounts/tests/test_models.py (ch18l023 )
1191
+ .src/accounts/tests/test_models.py (ch19l023 )
1192
1192
====
1193
1193
[source,python]
1194
1194
----
@@ -1225,7 +1225,7 @@ Password? Username? Bah! How about this?
1225
1225
1226
1226
1227
1227
[role="sourcecode"]
1228
- .src/accounts/models.py (ch18l025 )
1228
+ .src/accounts/models.py (ch19l025 )
1229
1229
====
1230
1230
[source,python]
1231
1231
----
@@ -1242,7 +1242,7 @@ And we wire it up inside _settings.py_, adding `accounts` to `INSTALLED_APPS`
1242
1242
and a variable called `AUTH_USER_MODEL`:
1243
1243
1244
1244
[role="sourcecode"]
1245
- .src/superlists/settings.py (ch18l026 )
1245
+ .src/superlists/settings.py (ch19l026 )
1246
1246
====
1247
1247
[source,python]
1248
1248
----
@@ -1284,7 +1284,7 @@ so you should be able to figure out the answers to these questions for yourself.
1284
1284
Here you go:
1285
1285
1286
1286
[role="sourcecode"]
1287
- .src/accounts/models.py (ch18l027 )
1287
+ .src/accounts/models.py (ch19l027 )
1288
1288
====
1289
1289
[source,python]
1290
1290
----
@@ -1310,7 +1310,7 @@ AttributeError: type object 'User' has no attribute 'USERNAME_FIELD'
1310
1310
And we go through a few more of these, until we get to:
1311
1311
1312
1312
[role="sourcecode"]
1313
- .src/accounts/models.py (ch18l029 )
1313
+ .src/accounts/models.py (ch19l029 )
1314
1314
====
1315
1315
[source,python]
1316
1316
----
@@ -1344,7 +1344,7 @@ Well, the simple way to fix that would be like this:
1344
1344
1345
1345
1346
1346
[role="sourcecode"]
1347
- .src/accounts/models.py (ch18l030 )
1347
+ .src/accounts/models.py (ch19l030 )
1348
1348
====
1349
1349
[source,python]
1350
1350
----
@@ -1371,7 +1371,7 @@ Migrations for 'accounts':
1371
1371
src/accounts/migrations/0001_initial.py
1372
1372
+ Create model User
1373
1373
----
1374
- //ch18l031
1374
+ //ch19l031
1375
1375
1376
1376
1377
1377
And the test passes:
@@ -1411,7 +1411,7 @@ and conceivably claim it was "just a refactor",
1411
1411
it would be better to have a specific test:
1412
1412
1413
1413
[role="sourcecode"]
1414
- .src/accounts/tests/test_models.py (ch18l032 )
1414
+ .src/accounts/tests/test_models.py (ch19l032 )
1415
1415
====
1416
1416
[source,python]
1417
1417
----
@@ -1439,7 +1439,7 @@ TIP: Your tests can be a form of documentation for your code--they
1439
1439
And here's the implementation (`primary_key` makes the `unique=True` obsolete):
1440
1440
1441
1441
[role="sourcecode"]
1442
- .src/accounts/models.py (ch18l033 )
1442
+ .src/accounts/models.py (ch19l033 )
1443
1443
====
1444
1444
[source,python]
1445
1445
----
@@ -1459,7 +1459,7 @@ Migrations for 'accounts':
1459
1459
src/accounts/migrations/0001_initial.py
1460
1460
+ Create model User
1461
1461
----
1462
- //ch18l034
1462
+ //ch19l034
1463
1463
1464
1464
// DAVID: Deleting migrations can get readers in a pickle if they have already run migrations locally.
1465
1465
// Might be worth saying we're only doing this because we've just created it, and advise them to delete
@@ -1509,7 +1509,7 @@ should be able to link an email to a unique ID,
1509
1509
and that ID shouldn't be the same two times in a row:
1510
1510
1511
1511
[role="sourcecode"]
1512
- .src/accounts/tests/test_models.py (ch18l035 )
1512
+ .src/accounts/tests/test_models.py (ch19l035 )
1513
1513
====
1514
1514
[source,python]
1515
1515
----
@@ -1534,7 +1534,7 @@ make migrations, get new error, delete migrations,
1534
1534
re-create new migrations, another code change, and so on...
1535
1535
1536
1536
1537
- [role="dofirst-ch18l036 "]
1537
+ [role="dofirst-ch19l036 "]
1538
1538
[subs="specialcharacters,macros"]
1539
1539
----
1540
1540
$ pass:quotes[*python src/manage.py test accounts*]
@@ -1546,7 +1546,7 @@ I'll trust you to go through these conscientiously--remember,
1546
1546
I may not be able to see you, but the Testing Goat can!
1547
1547
1548
1548
1549
- [role="dofirst-ch18l037 "]
1549
+ [role="dofirst-ch19l037 "]
1550
1550
[subs="specialcharacters,macros"]
1551
1551
----
1552
1552
$ pass:quotes[*python src/manage.py makemigrations*]
@@ -1561,8 +1561,8 @@ $ pass:quotes[*rm src/accounts/migrations/0002_token.py*]
1561
1561
1562
1562
Eventually you should get to this code...
1563
1563
1564
- [role="sourcecode dofirst-ch18l038 -0"]
1565
- .src/accounts/models.py (ch18l038 )
1564
+ [role="sourcecode dofirst-ch19l038 -0"]
1565
+ .src/accounts/models.py (ch19l038 )
1566
1566
====
1567
1567
[source,python]
1568
1568
----
@@ -1575,7 +1575,7 @@ class Token(models.Model):
1575
1575
1576
1576
And this error:
1577
1577
1578
- [role="dofirst-ch18l039 "]
1578
+ [role="dofirst-ch19l039 "]
1579
1579
[subs="specialcharacters,macros"]
1580
1580
----
1581
1581
$ pass:quotes[*python src/manage.py test accounts*]
@@ -1594,7 +1594,7 @@ We can use it like this:
1594
1594
// DAVID: It feels like a strange time to introduce it, seeing as we've already used it in the spike earlier.
1595
1595
1596
1596
[role="sourcecode"]
1597
- .src/accounts/models.py (ch18l040 )
1597
+ .src/accounts/models.py (ch19l040 )
1598
1598
====
1599
1599
[source,python]
1600
1600
----
@@ -1615,7 +1615,7 @@ that should get us to passing tests:
1615
1615
// but next time they make migrations it will include this change too. That doesn't matter that
1616
1616
// much but isn't as clean a git history. Might be simpler just to tell them to makemigrations.
1617
1617
1618
- [role="dofirst-ch18l041 "]
1618
+ [role="dofirst-ch19l041 "]
1619
1619
[subs="specialcharacters,quotes"]
1620
1620
----
1621
1621
$ *python src/manage.py test accounts*
0 commit comments