1
1
[[chapter_13_database_layer_validation]]
2
2
== Validation at the Database Layer
3
3
4
+ // RITA: Update the warning since you have reviewed the chapter text in detail?
4
5
.🚧 Warning, Chapter update in progress
5
6
*******************************************************************************
6
7
This chapter is currently in the process of being rewritten for the 3e.
@@ -256,6 +257,7 @@ been passed an error variable, and if so, we do this:
256
257
<1> We add the `.is-invalid` class to an form inputs with validation errors
257
258
<2> We use a `div.invalid-feedback` to display any error messages from the server.
258
259
260
+ // RITA: Perhaps put the Bootstrap docs note and the footnote text into a tip box?
259
261
((("Bootstrap", "documentation")))
260
262
((("form control classes (Bootstrap)")))
261
263
Take a look at the https://getbootstrap.com/docs/5.3/forms/validation/#server-side[Bootstrap docs] for more
@@ -360,7 +362,7 @@ blank.']}
360
362
361
363
So we try our first approach: using a `try/except` to detect errors. Obeying
362
364
the Testing Goat, we start with just the `try/except` and nothing else. The
363
- tests should tell us what to code next...
365
+ tests should tell us what to code next.
364
366
365
367
[role="sourcecode"]
366
368
.src/lists/views.py (ch11l025)
@@ -974,7 +976,7 @@ NOTE: One of the reasons that the "three strikes and refactor" rule exists is th
974
976
if you wait until you have three use cases, each might be slightly different,
975
977
and it gives you a better view for what the common functionality is.
976
978
If you refactor too early,
977
- you may find that the third use case doesn't quite fit with your refactored code...
979
+ you may find that the third use case doesn't quite fit with your refactored code.
978
980
((("database testing", "three strikes and refactor rule")))
979
981
((("Test-Driven Development (TDD)", "concepts", "three strikes and refactor")))
980
982
((("three strikes and refactor rule")))
@@ -1068,14 +1070,14 @@ OK
1068
1070
$ pass:quotes[*python src/manage.py test functional_tests*]
1069
1071
OK
1070
1072
----
1071
-
1073
+ // RITA: Perhaps add a few words after "Excellent" to explain what you're doing?
1072
1074
Excellent:
1073
1075
1074
1076
[subs="specialcharacters,quotes"]
1075
1077
----
1076
1078
$ *git commit -am "Refactor hard-coded URLs out of templates"*
1077
1079
----
1078
-
1080
+ // RITA: Please add a sentence to give the figure context. "Let's remove the item from our scratchpad."
1079
1081
[role="scratchpad"]
1080
1082
*****
1081
1083
* 'Remove hardcoded URLs from views.py'
@@ -1208,7 +1210,7 @@ $ pass:quotes[*python src/manage.py test functional_tests*]
1208
1210
OK
1209
1211
----
1210
1212
1211
- Cross off our to-dos...
1213
+ Time to cross off our to-dos...
1212
1214
1213
1215
[role="scratchpad"]
1214
1216
*****
@@ -1218,7 +1220,7 @@ Cross off our to-dos...
1218
1220
* 'Remove duplication of validation logic in views'
1219
1221
*****
1220
1222
1221
- And a commit...
1223
+ And commit...
1222
1224
1223
1225
[subs="specialcharacters,quotes"]
1224
1226
----
@@ -1231,7 +1233,7 @@ and we've taken the opportunity to do a few refactors along the way.
1231
1233
((("", startref="MLVhard13")))((("", startref="url13")))
1232
1234
1233
1235
1234
- That final scratchpad item will be the subject of the next chapter...
1236
+ That final scratchpad item will be the subject of the next chapter.
1235
1237
1236
1238
.On Database-Layer Validation
1237
1239
*******************************************************************************
0 commit comments