Skip to content

Commit d97d8c2

Browse files
committed
Update all refs to 5.1 -> 5.2 in the text
1 parent ab39720 commit d97d8c2

20 files changed

+53
-53
lines changed

chapter_01.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ You have 18 unapplied migration(s). Your project may not work properly until
227227
you apply the migrations for app(s): admin, auth, contenttypes, sessions.
228228
Run 'python manage.py migrate' to apply them.
229229
March 17, 2023 - 18:07:30
230-
Django version 5.1.4, using settings 'superlists.settings'
230+
Django version 5.2.4, using settings 'superlists.settings'
231231
Starting development server at http://127.0.0.1:8000/
232232
Quit the server with CONTROL-C.
233233
----

chapter_03_unit_test_first_view.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ and the view part is actually provided by the templates,
282282
but you can see the general idea is there!
283283

284284
If you're interested, you can look up the finer points of the discussion
285-
https://docs.djangoproject.com/en/5.1/faq/general/#django-appears-to-be-a-mvc-framework-but-you-call-the-controller-the-view-and-the-view-the-template-how-come-you-don-t-use-the-standard-names[in the Django FAQs].
285+
https://docs.djangoproject.com/en/5.2/faq/general/#django-appears-to-be-a-mvc-framework-but-you-call-the-controller-the-view-and-the-view-the-template-how-come-you-don-t-use-the-standard-names[in the Django FAQs].
286286

287287
Irrespective of any of that, as with any web server, Django's main job is to
288288
decide what to do when a user asks for a particular URL on our site.
@@ -692,7 +692,7 @@ How can we write a test for URL resolution?
692692
At the moment we just test the view function directly by importing it and calling it.
693693
But we want to test more layers of the Django stack.
694694
Django, like most web frameworks, supplies a tool for doing just that, called the
695-
https://docs.djangoproject.com/en/5.1/topics/testing/tools/#the-test-client[Django Test Client].
695+
https://docs.djangoproject.com/en/5.2/topics/testing/tools/#the-test-client[Django Test Client].
696696

697697
// CSANAD: it might be a little confusing first why we add a _unit_ test, considering this second
698698
// test case is closer to a user's point of view. We could point out this to be one example
@@ -864,7 +864,7 @@ Let's go take a look:
864864
URL configuration for superlists project.
865865
866866
The `urlpatterns` list routes URLs to views. For more information please see:
867-
https://docs.djangoproject.com/en/5.1/topics/http/urls/
867+
https://docs.djangoproject.com/en/5.2/topics/http/urls/
868868
Examples:
869869
Function views
870870
1. Add an import: from my_app import views

chapter_04_philosophy_and_refactoring.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ Some people like to use another subfolder named after the app
399399
This is called "template namespacing".
400400
I figured it was overcomplicated for this small project, but it may be worth it on larger projects.
401401
There's more in the
402-
https://docs.djangoproject.com/en/5.1/intro/tutorial03/#write-views-that-actually-do-something[Django tutorial].]
402+
https://docs.djangoproject.com/en/5.2/intro/tutorial03/#write-views-that-actually-do-something[Django tutorial].]
403403

404404
[role="sourcecode"]
405405
.lists/templates/home.html (ch04l002)

chapter_05_post_and_database.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,9 +1052,9 @@ Django has many other field types, like `IntegerField`, `CharField`,
10521052
`DateField`, and so on. I've chosen `TextField` rather than `CharField` because
10531053
the latter requires a length restriction, which seems arbitrary at this point.
10541054
You can read more on field types in the Django
1055-
https://docs.djangoproject.com/en/5.1/intro/tutorial02/#creating-models[tutorial]
1055+
https://docs.djangoproject.com/en/5.2/intro/tutorial02/#creating-models[tutorial]
10561056
and in the
1057-
https://docs.djangoproject.com/en/5.1/ref/models/fields/[documentation].
1057+
https://docs.djangoproject.com/en/5.2/ref/models/fields/[documentation].
10581058

10591059

10601060

@@ -1694,7 +1694,7 @@ will render with multiple `<tr>` rows, one for each item in the variable
16941694
`items`. Pretty neat! I'll introduce a few more bits of Django template
16951695
magic as we go, but at some point you'll want to go and read up on the rest of
16961696
them in the
1697-
https://docs.djangoproject.com/en/5.1/topics/templates/[Django docs].
1697+
https://docs.djangoproject.com/en/5.2/topics/templates/[Django docs].
16981698

16991699
Just changing the template doesn't get our tests to green; we need to actually
17001700
pass the items to it from our home page view:
@@ -1762,7 +1762,7 @@ called 'db.sqlite3' in the base project directory:
17621762
----
17631763
[...]
17641764
# Database
1765-
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
1765+
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
17661766
17671767
DATABASES = {
17681768
"default": {

chapter_07_working_incrementally.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ TIP: This is another place to pay attention to trailing slashes, incidentally.
11151115
// as we can have different methods on the same URL.
11161116
// Also, the way our Django app is configured, it will automatically redirect to a URL
11171117
// with the slash appended, so I'm not sure this makes much sense.
1118-
// https://docs.djangoproject.com/en/5.1/ref/settings/#append-slash
1118+
// https://docs.djangoproject.com/en/5.2/ref/settings/#append-slash
11191119

11201120
Try running that:
11211121

@@ -2352,7 +2352,7 @@ which is what we were trying to do anyway:
23522352
<1> There's our new form action.
23532353

23542354
<2> `.item_set` is called a
2355-
https://docs.djangoproject.com/en/5.1/topics/db/queries/#following-relationships-backward[reverse lookup].
2355+
https://docs.djangoproject.com/en/5.2/topics/db/queries/#following-relationships-backward[reverse lookup].
23562356
It's one of Django's incredibly useful bits of ORM that lets you look up an
23572357
object's related items from a different table.
23582358
((("reverse lookups")))

chapter_08_prettification.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ It's defined in _settings.py_:
649649
[...]
650650
651651
# Static files (CSS, JavaScript, Images)
652-
# https://docs.djangoproject.com/en/5.1/howto/static-files/
652+
# https://docs.djangoproject.com/en/5.2/howto/static-files/
653653
654654
STATIC_URL = "static/"
655655
----
@@ -696,7 +696,7 @@ To get it to work, we need to change it to:
696696
====
697697

698698
// DAVID: Django best practice would be to use the static tag instead.
699-
// https://docs.djangoproject.com/en/5.1/howto/static-files/#configuring-static-files
699+
// https://docs.djangoproject.com/en/5.2/howto/static-files/#configuring-static-files
700700

701701
Now when `runserver` sees the request,
702702
it knows that it's for a static file because it begins with `/static/`.
@@ -729,7 +729,7 @@ That's because, although `runserver` automagically finds static files,
729729
Never fear, though:
730730
the Django developers have made an even more magical test class
731731
called `StaticLiveServerTestCase`
732-
(see https://docs.djangoproject.com/en/5.1/ref/contrib/staticfiles/#django.contrib.staticfiles.testing.StaticLiveServerTestCase[the docs]).
732+
(see https://docs.djangoproject.com/en/5.2/ref/contrib/staticfiles/#django.contrib.staticfiles.testing.StaticLiveServerTestCase[the docs]).
733733

734734
// JAN: Maybe you could mention that StaticLiveServerTestCase inherits from LiveServerTestCase - so all previous should work + static files. After reading the name, I imagined StaticLiveServerTestCase as some special test class for testing only static-related stuff
735735

@@ -1010,7 +1010,7 @@ making it relative to the location of the project base directory:
10101010
[source,python]
10111011
----
10121012
# Static files (CSS, JavaScript, Images)
1013-
# https://docs.djangoproject.com/en/5.1/howto/static-files/
1013+
# https://docs.djangoproject.com/en/5.2/howto/static-files/
10141014
10151015
STATIC_URL = "static/"
10161016
STATIC_ROOT = BASE_DIR / "static"

chapter_09_docker.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ System check identified no issues (0 silenced).
882882
883883
You have 19 unapplied migration(s). Your project may not [...]
884884
[...]
885-
Django version 5.1.4, using settings 'superlists.settings'
885+
Django version 5.2.4, using settings 'superlists.settings'
886886
Starting development server at http://127.0.0.1:8000/
887887
Quit the server with CONTROL-C.
888888
----

chapter_10_production_readiness.asciidoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ $ *pip freeze*
298298
asgiref==3.8.1
299299
attrs==23.2.0
300300
certifi==2024.2.2
301-
django==5.1.4
301+
django==5.2.4
302302
gunicorn==21.2.0
303303
h11==0.14.0
304304
idna==3.6
@@ -326,7 +326,7 @@ Django, Gunicorn and Whitenoise:
326326
[subs="specialcharacters,quotes"]
327327
----
328328
$ *pip freeze | grep -i django*
329-
Django==5.1.[...]
329+
Django==5.2.[...]
330330
331331
$ *pip freeze | grep -i django >> requirements.txt*
332332
$ *pip freeze | grep -i gunicorn >> requirements.txt*
@@ -341,7 +341,7 @@ That should give us a requirements.txt file that looks like this:
341341
====
342342
[source,python]
343343
----
344-
django==5.1.4
344+
django==5.2.4
345345
gunicorn==21.2.0
346346
whitenoise==6.6.0
347347
----
@@ -459,7 +459,7 @@ _settings.py_ that we want to change for production:
459459
because that code might be visible to strangers.
460460
We'll want to generate a new, random one
461461
but then keep it the same for the foreseeable future
462-
(find out more in the https://docs.djangoproject.com/en/5.1/topics/signing/[Django docs]).
462+
(find out more in the https://docs.djangoproject.com/en/5.2/topics/signing/[Django docs]).
463463

464464
Development, staging and production sites always have some differences
465465
in their configuration.
@@ -641,7 +641,7 @@ By default, when DEBUG=True, `ALLOWED_HOSTS` effectively allows _localhost_,
641641
our own machine, so that's why it was working OK until now.
642642

643643
There's more information in the
644-
https://docs.djangoproject.com/en/5.1/ref/settings/#allowed-hosts[Django docs].
644+
https://docs.djangoproject.com/en/5.2/ref/settings/#allowed-hosts[Django docs].
645645

646646
The upshot is that we need to adjust `ALLOWED_HOSTS` in _settings.py_.
647647
Let's use another environment variable for that:
@@ -860,7 +860,7 @@ but it's more of shock to see that they are no longer appearing in the terminal
860860
If you're like me you might find yourself wondering if we really _did_ see them earlier
861861
and starting to doubt your own sanity.
862862
But the explanation is that Django's
863-
https://docs.djangoproject.com/en/5.1/ref/logging/#default-logging-configuration[default logging configuration]
863+
https://docs.djangoproject.com/en/5.2/ref/logging/#default-logging-configuration[default logging configuration]
864864
changes when DEBUG is turned off.
865865

866866
This means we need to interact with the standard library's `logging` module,

chapter_14_database_layer_validation.asciidoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ But all is not quite as it seems,
150150
because _this test should already pass_.
151151

152152
If you take a look at the
153-
https://docs.djangoproject.com/en/5.1/ref/models/fields/#blank[docs for the Django model fields],
153+
https://docs.djangoproject.com/en/5.2/ref/models/fields/#blank[docs for the Django model fields],
154154
you'll see under _Field options_ that the default setting for _all_ fields is
155155
`blank=False`.
156156
Since TextField is a type of Field, it _should_ already disallow empty values.
@@ -289,7 +289,7 @@ Django models don't run full validation on save.
289289
((("full_clean method")))
290290
Django does have a method to manually run full validation, however,
291291
called `full_clean` (more info in
292-
https://docs.djangoproject.com/en/5.1/ref/models/instances/#django.db.models.Model.full_clean[the docs]).
292+
https://docs.djangoproject.com/en/5.2/ref/models/instances/#django.db.models.Model.full_clean[the docs]).
293293
Let's swap that for the `.save()` and see if it works:
294294

295295

@@ -559,7 +559,7 @@ self.assertContains(response, expected_error)
559559
====
560560

561561
...will show us the cause—Django has
562-
https://docs.djangoproject.com/en/5.1/ref/templates/builtins/#autoescape[HTML-escaped]
562+
https://docs.djangoproject.com/en/5.2/ref/templates/builtins/#autoescape[HTML-escaped]
563563
the apostrophe:
564564

565565
[subs="specialcharacters,macros"]
@@ -1225,7 +1225,7 @@ a [keep-together]#parameter#:
12251225
====
12261226

12271227
See the
1228-
https://docs.djangoproject.com/en/5.1/topics/http/urls/#reverse-resolution-of-urls[Django
1228+
https://docs.djangoproject.com/en/5.2/topics/http/urls/#reverse-resolution-of-urls[Django
12291229
docs on reverse URL resolution] for more info. We run the tests again, and check that they all pass:
12301230

12311231
[subs="specialcharacters,macros"]
@@ -1309,7 +1309,7 @@ AttributeError: 'List' object has no attribute 'get_absolute_url'
13091309
The implementation is to use Django's `reverse` function, which
13101310
essentially does the reverse of what Django normally does with _urls.py_
13111311
(see the
1312-
https://docs.djangoproject.com/en/5.1/topics/http/urls/#reverse-resolution-of-urls[docs]):
1312+
https://docs.djangoproject.com/en/5.2/topics/http/urls/#reverse-resolution-of-urls[docs]):
13131313

13141314

13151315
[role="sourcecode"]
@@ -1343,7 +1343,7 @@ def new_list(request):
13431343
====
13441344

13451345
There's more info in the
1346-
https://docs.djangoproject.com/en/5.1/topics/http/shortcuts/#redirect[Django docs].
1346+
https://docs.djangoproject.com/en/5.2/topics/http/shortcuts/#redirect[Django docs].
13471347
Quick check that the unit tests still pass:
13481348

13491349
[subs="specialcharacters,macros"]

chapter_15_simple_form.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ and which fields we want it to use.
249249
like assigning sensible HTML form input types to different types of field,
250250
and applying default validation.
251251
Check out the
252-
https://docs.djangoproject.com/en/5.1/topics/forms/modelforms/[docs]
252+
https://docs.djangoproject.com/en/5.2/topics/forms/modelforms/[docs]
253253
for more info.
254254

255255
We now have some different-looking form HTML:
@@ -1208,7 +1208,7 @@ using a form is a nice way of encapsulating that logic.
12081208
// DAVID: I wonder if this is slightly missing the point.
12091209
// Our functional tests here are very high level - using a headless browser.
12101210
// But many developers use the Django test client
1211-
// (https://docs.djangoproject.com/en/5.1/topics/testing/tools/#the-test-client)
1211+
// (https://docs.djangoproject.com/en/5.2/topics/testing/tools/#the-test-client)
12121212
// for this kind of thing, which doesn't have browser validation built in.
12131213
// So we could use that if we really wanted to test the server side validation.
12141214
//

0 commit comments

Comments
 (0)