Skip to content

Commit 2cba47c

Browse files
dyveclaude
andauthored
docs: cover jQuery and the stale settings block in the migration guide (#893)
The guide said "load it yourself if you need it" about jQuery and left it there. Say what actually replaces it: there is no `jquery_url` setting and no `{% bootstrap_jquery %}` or `{% bootstrap_jquery_url %}` tag, so it comes from your own template. For most projects that is the whole story, because `include_jquery` defaulted to `False` in both packages and the jQuery on the page was already theirs. It bites through `jquery_url`, whose django-bootstrap3 default was the unversioned `//code.jquery.com/jquery.min.js`. That alias still serves jQuery 1.11.1 from 2014 and is not updated, so a project on the default has been serving a jQuery that is two majors behind. Bootstrap 3 itself accepted `1.9.1 - 3`, so nothing about Bootstrap 3 held it there. Point at jQuery's own upgrade guide rather than restating it, and say to check plugins at the same time, since an old jQuery tends to come with old plugins. One project had to take bootstrap-datepicker from 1.6.0 to 1.10.0. django-bootstrap4 defaulted to jQuery 3.5.1, so no major jQuery upgrade comes with that move at all. The django-bootstrap4 section said the opposite. Also say to delete the `BOOTSTRAP3` block after adding a `BOOTSTRAP5` one. `W001` only inspects `BOOTSTRAP5`, so a leftover block is invisible to it while still reading like configuration. In the project this came from it named the same jQuery file a `<script>` tag in the base template loaded directly, so it was the first place anyone looked to find out how jQuery reached the page. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 2a0cf12 commit 2cba47c

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
- Cover jQuery in the migration guide: what replaces the `jquery_url` setting and the jQuery tags, and that django-bootstrap3's default pointed at a CDN alias still serving jQuery 1.11.1, so choosing a version is likely a jump of two majors. Also say to delete the old `BOOTSTRAP3` block, since `W001` only inspects `BOOTSTRAP5` and a leftover block reads like live configuration with nothing warning about it.
56
- Document migrating from django-bootstrap3 in `MIGRATE.md`: renamed settings and their changed defaults, the removed `buttons`, `bootstrap_icon` and `bootstrap_message_classes`, renamed tag arguments, and the Bootstrap class changes that take most of the work.
67
- **Breaking:** Remove `django_bootstrap5.text.text_concat`. It is a general string helper, not a Bootstrap concern, and nothing in the package has ever called it: its one caller joined an icon to a button label and went away when icon support was removed, before this package was forked. It was never documented. If you import it, the replacement is three lines (#889).
78
- Remove `BaseRenderer.get_size_class`, which nothing called. The module-level `get_size_class` in `django_bootstrap5.size` is the one in use, and the method shadowed its name inside the class body.

‎MIGRATE.md‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ New settings include `wrapper_class` (default `"mb-3"`), `horizontal_field_offse
4040
A system check, `django_bootstrap5.W001`, warns about keys in `BOOTSTRAP5` that the package does not read, which
4141
catches settings carried over from `BOOTSTRAP3`.
4242

43+
**Delete the `BOOTSTRAP3` block once you have a `BOOTSTRAP5` one.** `W001` only inspects `BOOTSTRAP5`, so a leftover
44+
block is invisible to it while still reading like live configuration. In one project it sat directly above the working
45+
`BOOTSTRAP5` block, with `jquery_url` naming the same file that a `<script>` tag in the base template loaded directly.
46+
Nothing read the setting any more, but it was the first place anyone looked to find out how jQuery reached the page.
47+
4348
### Removed template tags and filters
4449

4550
#### buttons
@@ -103,6 +108,22 @@ does nothing, so search your templates for the old names.
103108
`layout="horizontal"` builds the grid itself. The `form-horizontal` class on `<form>`, which Bootstrap 3 needed next to
104109
it, no longer exists and can go. `layout="inline"` still exists.
105110

111+
### jQuery
112+
113+
Bootstrap 5 does not use jQuery. This package has no `jquery_url` setting and no `{% bootstrap_jquery %}` or
114+
`{% bootstrap_jquery_url %}` tag, so load jQuery from your own template if your code needs it.
115+
116+
For most projects that is all it is, because `include_jquery` defaulted to `False` and the jQuery on the page was
117+
already yours. Where it matters is `jquery_url`, whose default was the unversioned `//code.jquery.com/jquery.min.js`.
118+
That alias still serves jQuery 1.11.1, released in 2014, and is not updated, so a project on the default has been
119+
serving 1.11.1 rather than anything recent. Bootstrap 3 itself accepted `1.9.1 - 3`, so nothing about Bootstrap 3 held
120+
you there, only the default.
121+
122+
Choosing the version yourself is therefore likely to be a jump of two majors. Read jQuery's
123+
[upgrade guide](https://jquery.com/upgrade-guide/) rather than assuming the code still runs, and check your plugins at
124+
the same time, since an old jQuery tends to come with old plugins. One project had to take bootstrap-datepicker from
125+
1.6.0 to 1.10.0 before it ran.
126+
106127
### Bootstrap's own class changes
107128

108129
Not part of this package, but they are most of the work in templates. The ones that came up most:
@@ -141,7 +162,8 @@ The `{% buttons %} ... {% endbuttons %}` tag has been removed. To create buttons
141162

142163
Bootstrap 5 does not depend on jQuery. Every function and tag referencing jQuery has been removed.
143164

144-
If you need jQuery, you will have to include it yourself.
165+
If you need jQuery, you will have to include it yourself. django-bootstrap4 defaulted to jQuery 3.5.1, so there is no
166+
major jQuery upgrade in this move, only the loading.
145167

146168
### Popper
147169

0 commit comments

Comments
 (0)