From 5537a667f42643d060e4d11508bbd0e31f40e8da Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Wed, 22 Nov 2023 10:43:52 +0800 Subject: [PATCH 01/45] Upgrade Wagtail to 5.1, upgrade Wagtail module packages --- poetry.lock | 124 ++++++++++++++++++++++++++++++++++++++----------- pyproject.toml | 6 +-- 2 files changed, 99 insertions(+), 31 deletions(-) diff --git a/poetry.lock b/poetry.lock index 657c2fc9..43416657 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1512,6 +1512,75 @@ files = [ docs = ["furo", "olefile", "sphinx (>=2.4)", "sphinx-copybutton", "sphinx-inline-tabs", "sphinx-removed-in", "sphinxext-opengraph"] tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "packaging", "pyroma", "pytest", "pytest-cov", "pytest-timeout"] +[[package]] +name = "pillow-heif" +version = "0.13.1" +description = "Python interface for libheif library" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pillow_heif-0.13.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:62a0269a06119ae1395e28803677d46d4895410a360133d244dcffa6ecfdd4b9"}, + {file = "pillow_heif-0.13.1-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:ba6f634008762818033e7df942e0fa6649dec95fbbaaf8de498d7e43ff136435"}, + {file = "pillow_heif-0.13.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f9e7964e54b65bb7fb9b60e606dcb21582d7eea1046364d380a74081bec61478"}, + {file = "pillow_heif-0.13.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7925f04312f39b7ef1334f1d676f901ba09615d1ccbec95b49c87af80677f383"}, + {file = "pillow_heif-0.13.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:c02598f2103d385366dbd0c29da8a2bd30521d9cfc2f7342698839bf0c69e15a"}, + {file = "pillow_heif-0.13.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:3239390575a25b1fd1bc8f41f0d3783c1aa26c77a467731fa301175d542f5e8b"}, + {file = "pillow_heif-0.13.1-cp310-cp310-win_amd64.whl", hash = "sha256:24a8c78a5fc2e5efa3650a10c061cd507888896d583c4e63a54549b34cb84d05"}, + {file = "pillow_heif-0.13.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:779af08dc4dc0e787608ef035a525de40bf98e946ab194e3f702510c07af5f80"}, + {file = "pillow_heif-0.13.1-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:df4eba9bd64bb50656eda31acddac58f53bc3f2c5b35ea8c90438a7e2763bce7"}, + {file = "pillow_heif-0.13.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b586ba25c003bc2b608fe5cd1396b738b838ad4277348a5ca4525aac1f28e7b9"}, + {file = "pillow_heif-0.13.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5389574c874805bd6a3f2d5ef14ef90b61fdbebd75b58798677e84018caac6c1"}, + {file = "pillow_heif-0.13.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:736800774f9754ebfeba21ae137db0aa9f19df17521aee70ceeb68e569a5fb00"}, + {file = "pillow_heif-0.13.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:86f47db53eb719bccddb14cadd91fe9fa38b57aa07e3823ffe74b796a2bc50f2"}, + {file = "pillow_heif-0.13.1-cp311-cp311-win_amd64.whl", hash = "sha256:4f0eb2babec34900367384feaacff9a2f42e959767ba5df214560ef579b657b1"}, + {file = "pillow_heif-0.13.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:14787322b70e9cb02e599ef836f33181f981383f4848206f9fe5a272821806cb"}, + {file = "pillow_heif-0.13.1-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:f483c68895faad5af313e30c546cd935389ee99e59522d12f53225b46dcb9753"}, + {file = "pillow_heif-0.13.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ae9169e1ec94793d1b9ffe98ee39f856ca002e3ac476eaef0b524fedc81d2304"}, + {file = "pillow_heif-0.13.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c8e11c2a564663ce52f56851f3b9653abb254ec520191d3cf7841fcd02c29e3a"}, + {file = "pillow_heif-0.13.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:023ec7a6f085be0cf33e1b4458575579e3952da36b9c32956dbb2749b53e63b3"}, + {file = "pillow_heif-0.13.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:459b8536e86df2f957998f9ba830ae3e8a51177db67d1a9cb7243402bb70b576"}, + {file = "pillow_heif-0.13.1-cp312-cp312-win_amd64.whl", hash = "sha256:6fa3661f6f8c6c28e4e565c7aa9e4a1ae2507aa1f3691f831d3a9bfd465ceea4"}, + {file = "pillow_heif-0.13.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:b78e59d89d57dbfa27b346ea5841bd80c61441d5dddfbaa135007dea81a24a53"}, + {file = "pillow_heif-0.13.1-cp38-cp38-macosx_12_0_arm64.whl", hash = "sha256:52b26bd99c1604fcd2760b0826e79a3301b6269ff6c129750e0e6ef4e4980f96"}, + {file = "pillow_heif-0.13.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a4f03ee12b249725144cf01bbacaf99029e54a67495fd2df6c29c493c44cdb15"}, + {file = "pillow_heif-0.13.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a23e660c73739e2e4e3b18667bc478c4d62b31dfba07d962f1e8256bd37148b3"}, + {file = "pillow_heif-0.13.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:e72ee2971b722110fa6eb4b0ff640fc3854d9959f9a61f93eba62a16c6c40b75"}, + {file = "pillow_heif-0.13.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:403a652a6665b1672590890edf2489686dc343c05fa2cae320ffc551de315392"}, + {file = "pillow_heif-0.13.1-cp38-cp38-win_amd64.whl", hash = "sha256:385b93f575c98bd69bcefe2b013af324ed9c50d4600449f46fe784e909ac370e"}, + {file = "pillow_heif-0.13.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b56974c11e63ef1cda133bdd2eac2b4a992448a92dab3fcd20c5ec3195958952"}, + {file = "pillow_heif-0.13.1-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:426662a4c3da6c499627303b858accb482583f7f1c5874d40057a8c843a3d53f"}, + {file = "pillow_heif-0.13.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bce196e134b1dec0b82c157b27d665deb2193cbcce5a338a06766819a1878df9"}, + {file = "pillow_heif-0.13.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:97154e03be732005b51130aedff30229e9ae5038fa717afaca30e22d3e49d69e"}, + {file = "pillow_heif-0.13.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:1ac0bbcacb84e270c4accb519bf115dc18b80d7b3e283ddbb98bb77af613f5f4"}, + {file = "pillow_heif-0.13.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:6312ee1730e742851e0f2fec60b1390db9ffd831a26fd967fb3c7ed8a3f61197"}, + {file = "pillow_heif-0.13.1-cp39-cp39-win_amd64.whl", hash = "sha256:894caef12129966df326605b8ce7a18b88fabf50dcf3bdd4595ddf76c8543b9e"}, + {file = "pillow_heif-0.13.1-pp310-pypy310_pp73-macosx_10_9_x86_64.whl", hash = "sha256:e7651354c30a4e2fb075df2a0e48ae3193a0b378ee2c262dea63b5b3013ec9b5"}, + {file = "pillow_heif-0.13.1-pp310-pypy310_pp73-macosx_12_0_arm64.whl", hash = "sha256:9998235d3f1edfec3691161dbe83501b7139840d80caef640a9c87d7d5934b69"}, + {file = "pillow_heif-0.13.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2c8f070fe3705a52ef34c6b8cd39c29529972b5d7e2388a80530421e6d042b38"}, + {file = "pillow_heif-0.13.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:64b6ab214fa5ec6f709ec79b7bc2abaecba1553849ef0f04cd8ab1cf3b0aaf94"}, + {file = "pillow_heif-0.13.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:2fd56909022dfff4e02397585dda6b3ae25cd11adf1123c5617224947734205b"}, + {file = "pillow_heif-0.13.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:b3bd97b4ce968a776eb04c1085f20834d100021407398d1ea6db2c9fa4167fed"}, + {file = "pillow_heif-0.13.1-pp38-pypy38_pp73-macosx_12_0_arm64.whl", hash = "sha256:c4f6125b5d3d18a17e43318ceaadc0eaad12ec37948bb7cc3ffee016c9d62ea4"}, + {file = "pillow_heif-0.13.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9c0a9763fb132b606c3fc1f749f3c4b94e01453a96366b9746d61c431626af12"}, + {file = "pillow_heif-0.13.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:441751e7a09d4f253f48a4076fdf4778eea6d90fd8a57f0afde27236ba535eb1"}, + {file = "pillow_heif-0.13.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:6edc64c8e7172364bbeff09745cd76e443e673f68bd84708904dcdedab2645fd"}, + {file = "pillow_heif-0.13.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:1f61ebf35ad81994fcde3e7a7ebd15adc9dc9419aab97c6e4a535c04940daa20"}, + {file = "pillow_heif-0.13.1-pp39-pypy39_pp73-macosx_12_0_arm64.whl", hash = "sha256:a7745c019f954aab611299908089e3e53f45ed4eda057cb32782b90cbf5c1ef9"}, + {file = "pillow_heif-0.13.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:99235d323388de1bef001f06f6a35f20a1d6954896d79e44f4dc4d2bb6f3229c"}, + {file = "pillow_heif-0.13.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2e360c0c533345b34e05b923b49abbf08ec7ebe8e17f6cca6b446d386b7fd8b3"}, + {file = "pillow_heif-0.13.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:d9cf0b1a18e660b829fb9c618b5539c3c741301009ff06e8438b89211e890a13"}, + {file = "pillow_heif-0.13.1.tar.gz", hash = "sha256:0d46adc8a8afb515297fd47fc0b15657b8927f7ec52ad1fb8d63250413d4c6ba"}, +] + +[package.dependencies] +pillow = ">=9.1.1" + +[package.extras] +dev = ["coverage", "defusedxml", "numpy", "opencv-python (==4.8.1.78)", "packaging", "pre-commit", "pylint", "pympler", "pytest"] +docs = ["sphinx (>=4.4)", "sphinx-issues (>=3.0.1)", "sphinx-rtd-theme (>=1.0)"] +tests = ["defusedxml", "numpy", "packaging", "pympler", "pytest"] +tests-min = ["defusedxml", "packaging", "pytest"] + [[package]] name = "platformdirs" version = "3.10.0" @@ -2162,23 +2231,23 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess [[package]] name = "wagtail" -version = "5.0.5" +version = "5.1.3" description = "A Django content management system." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "wagtail-5.0.5-py3-none-any.whl", hash = "sha256:ec59a23013ef8cbc260d95ed73977010985edf5f8cb6097fdd740db6854babee"}, - {file = "wagtail-5.0.5.tar.gz", hash = "sha256:cbdef3e08d87a949cb2a63afb73c112e8921bb91608711fa1a9608f5591a77e2"}, + {file = "wagtail-5.1.3-py3-none-any.whl", hash = "sha256:f4a6cc2adc40f687d8fb62fed2d4fc0804941dfa45b4624887f260dc6cf6b9f2"}, + {file = "wagtail-5.1.3.tar.gz", hash = "sha256:45fac794e4c20c7e75b018069d7f9761f25faa3619ef30df24013ca24abf9a74"}, ] [package.dependencies] anyascii = ">=0.1.5" beautifulsoup4 = ">=4.8,<4.12" Django = ">=3.2,<4.3" -django-filter = ">=2.2,<23" +django-filter = ">=2.2,<24" django-modelcluster = ">=6.0,<7.0" django-permissionedforms = ">=0.1,<1.0" -django-taggit = ">=2.0,<4.0" +django-taggit = ">=2.0,<5.0" django-treebeard = ">=4.5.1,<5.0" djangorestframework = ">=3.11.1,<4.0" draftjs-exporter = ">=2.1.5,<3.0" @@ -2188,15 +2257,15 @@ openpyxl = ">=3.0.10,<4.0" Pillow = ">=9.1.0,<11.0.0" requests = ">=2.11.1,<3.0" telepath = ">=0.1.1,<1" -Willow = ">=1.5,<1.7" +Willow = {version = ">=1.6.2,<1.7", extras = ["heif"]} [package.extras] -docs = ["Sphinx (>=1.5.2)", "myst-parser (==0.18.1)", "pyenchant (>=3.1.1,<4)", "sphinx-autobuild (>=0.6.0)", "sphinx-copybutton (>=0.5,<1.0)", "sphinx-wagtail-theme (==6.0.0)", "sphinxcontrib-spelling (>=5.4.0,<6)"] -testing = ["Jinja2 (>=3.0,<3.2)", "azure-mgmt-cdn (>=12.0,<13.0)", "azure-mgmt-frontdoor (>=1.0,<1.1)", "black (==22.3.0)", "boto3 (>=1.16,<1.17)", "coverage (>=3.7.0)", "curlylint (==0.13.1)", "django-pattern-library (>=0.7,<0.8)", "djhtml (==1.5.2)", "doc8 (==0.8.1)", "elasticsearch (>=5.0,<6.0)", "factory-boy (>=3.2)", "flake8 (>=3.6.0,<6.1)", "flake8-assertive (==2.0.0)", "flake8-blind-except (==0.1.1)", "flake8-comprehensions (==3.8.0)", "flake8-print (==5.0.0)", "freezegun (>=0.3.8)", "isort (==5.6.4)", "polib (>=1.1,<2.0)", "python-dateutil (>=2.7)", "pytz (>=2014.7)", "semgrep (==1.3.0)"] +docs = ["Sphinx (>=1.5.2)", "myst-parser (==0.18.1)", "pyenchant (>=3.1.1,<4)", "sphinx-autobuild (>=0.6.0)", "sphinx-copybutton (>=0.5,<1.0)", "sphinx-wagtail-theme (==6.1.1)", "sphinxcontrib-spelling (>=5.4.0,<6)"] +testing = ["Jinja2 (>=3.0,<3.2)", "azure-mgmt-cdn (>=12.0,<13.0)", "azure-mgmt-frontdoor (>=1.0,<1.1)", "black (==22.3.0)", "boto3 (>=1.16,<1.17)", "coverage (>=3.7.0)", "curlylint (==0.13.1)", "django-pattern-library (>=0.7,<0.8)", "djhtml (==1.5.2)", "doc8 (==0.8.1)", "factory-boy (>=3.2)", "freezegun (>=0.3.8)", "polib (>=1.1,<2.0)", "python-dateutil (>=2.7)", "pytz (>=2014.7)", "ruff (==0.0.272)", "semgrep (==1.3.0)"] [[package]] name = "wagtail-django-recaptcha" -version = "1.0" +version = "2.0" description = "A simple recaptcha field for Wagtail Form Pages." optional = false python-versions = "*" @@ -2212,8 +2281,8 @@ testing = ["coverage (>=6.5.0,<6.6)", "flake8 (>=5.0.4,<5.1)", "isort (>=5.10.1) [package.source] type = "git" url = "https://github.com/torchbox-forks/wagtail-django-recaptcha" -reference = "2.0.0" -resolved_reference = "35975f98176af5d5a2515ec0e9de116e33a37fda" +reference = "2.1.0" +resolved_reference = "23056b5d59fb42f7a531c9b0eb89edea419dd0bb" [[package]] name = "wagtail-factories" @@ -2250,12 +2319,14 @@ wagtail = ">=4.1" [[package]] name = "wagtail-transfer" -version = "0.9.1" -description = "" +version = "0.9.3" +description = "Content transfer for Wagtail" optional = false python-versions = ">=3.7" -files = [] -develop = false +files = [ + {file = "wagtail-transfer-0.9.3.tar.gz", hash = "sha256:f3b6248b41033145a353e8bd7f3909c7960c3b23ee910d0a6d9a7bf748845cfe"}, + {file = "wagtail_transfer-0.9.3-py3-none-any.whl", hash = "sha256:41b2414899d95ac3024fb2a9a280438537c0ed360ee005067fbe8f1fcf2c6d05"}, +] [package.dependencies] wagtail = ">=4.1" @@ -2263,12 +2334,6 @@ wagtail = ">=4.1" [package.extras] docs = ["mkdocs (>=1.0,<1.1)", "mkdocs-material (>=4.6,<4.7)"] -[package.source] -type = "git" -url = "https://github.com/torchbox-forks/wagtail-transfer" -reference = "wagtail-50" -resolved_reference = "379390326f8e0b05aa4677bdc58416da97ee3bd6" - [[package]] name = "wagtailgeowidget" version = "8.0.0" @@ -2368,21 +2433,24 @@ brotli = ["Brotli"] [[package]] name = "willow" -version = "1.5.1" +version = "1.6.2" description = "A Python image library that sits on top of Pillow, Wand and OpenCV" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "Willow-1.5.1-py3-none-any.whl", hash = "sha256:ffb95732d4729d1a3478407f697b623467d6ebd1da77e0d44c1016bc69825711"}, - {file = "Willow-1.5.1.tar.gz", hash = "sha256:b7a4909110133fdb1e2287592e0673cc255e0286e1cd53427ee68df1c9220c4c"}, + {file = "willow-1.6.2-py3-none-any.whl", hash = "sha256:957a4af8a7733e116a65eca34da11afe3fd52ffdb397494c8823901c25863787"}, + {file = "willow-1.6.2.tar.gz", hash = "sha256:e2d0450fd78ab19052d0478b888ef163e3264e8dcd1af002dd691458db98056f"}, ] [package.dependencies] defusedxml = ">=0.7,<1.0" filetype = ">=1.0.10,<1.1.0 || >1.1.0" +pillow-heif = {version = ">=0.10.0,<1.0.0", optional = true, markers = "extra == \"heif\""} [package.extras] -testing = ["Pillow (>=9.1.0,<11.0.0)", "Wand (>=0.6,<1.0)", "mock (>=3.0,<4.0)", "pillow-heif (>=0.7.0,<1.0.0)"] +docs = ["Sphinx (>=7.0)", "sphinx-wagtail-theme (==6.0.0)", "sphinx_copybutton (>=0.5)", "sphinxcontrib-spelling (>=8.0,<9.0)"] +heif = ["pillow-heif (>=0.10.0,<1.0.0)"] +testing = ["Pillow (>=9.1.0,<11.0.0)", "Wand (>=0.6,<1.0)", "black (==22.3.0)", "coverage[toml] (>=7.2.7,<8.0)", "mock (>=3.0,<4.0)", "pillow-heif (>=0.10.0,<1.0.0)", "ruff (==0.0.275)"] [[package]] name = "zeep" @@ -2435,4 +2503,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "d4ccd706ee2633cfe3596be7293841cc6a5d38e17251a615325d315eb5eb7883" +content-hash = "6349c4303a6beaf1afdb1b4bbe040362163a5fab8fe878d9fca162257d3053e7" diff --git a/pyproject.toml b/pyproject.toml index 5705860a..b3d97b97 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,11 +27,11 @@ redis = "2.10.6" scout-apm = "2.0.2" tabulate = "0.8.7" urllib3 = "1.26.11" -wagtail = "~5.0" -wagtail-django-recaptcha = {git = "https://github.com/torchbox-forks/wagtail-django-recaptcha", tag = "2.0.0"} +wagtail = "~5.1" +wagtail-django-recaptcha = {git = "https://github.com/torchbox-forks/wagtail-django-recaptcha", tag = "2.1.0"} wagtail-factories = "^4.1.0" wagtail-orderable = "^1.2.0" -wagtail-transfer = {git = "https://github.com/torchbox-forks/wagtail-transfer", tag = "v0.9.2rc1"} +wagtail-transfer = "^0.9.3" wagtailgeowidget = "8.0.0" whitenoise = "5.0" zeep = "3.4.0" From c849bc745bd21074943c1aab75b25e727cb89f25 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Wed, 22 Nov 2023 10:48:20 +0800 Subject: [PATCH 02/45] =?UTF-8?q?Wagtail=205.1=20upgrade=20consideration:?= =?UTF-8?q?=20GroupPagePermission=20now=20uses=20Django=E2=80=99s=20Permis?= =?UTF-8?q?sion=20model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bc/fixtures/wagtailcore/demo_data.json | 32 +++++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/bc/fixtures/wagtailcore/demo_data.json b/bc/fixtures/wagtailcore/demo_data.json index 774ddda1..01110097 100644 --- a/bc/fixtures/wagtailcore/demo_data.json +++ b/bc/fixtures/wagtailcore/demo_data.json @@ -741,12 +741,20 @@ { "model": "wagtailcore.grouppagepermission", "pk": 1, - "fields": { "group": ["Moderators"], "page": 1, "permission_type": "add" } + "fields": { + "group": ["Moderators"], + "page": 1, + "permission": ["add_page", "wagtailcore", "page"] + } }, { "model": "wagtailcore.grouppagepermission", "pk": 2, - "fields": { "group": ["Moderators"], "page": 1, "permission_type": "edit" } + "fields": { + "group": ["Moderators"], + "page": 1, + "permission": ["change_page", "wagtailcore", "page"] + } }, { "model": "wagtailcore.grouppagepermission", @@ -754,23 +762,35 @@ "fields": { "group": ["Moderators"], "page": 1, - "permission_type": "publish" + "permission": ["publish_page", "wagtailcore", "page"] } }, { "model": "wagtailcore.grouppagepermission", "pk": 4, - "fields": { "group": ["Editors"], "page": 1, "permission_type": "add" } + "fields": { + "group": ["Editors"], + "page": 1, + "permission": ["add_page", "wagtailcore", "page"] + } }, { "model": "wagtailcore.grouppagepermission", "pk": 5, - "fields": { "group": ["Editors"], "page": 1, "permission_type": "edit" } + "fields": { + "group": ["Editors"], + "page": 1, + "permission": ["change_page", "wagtailcore", "page"] + } }, { "model": "wagtailcore.grouppagepermission", "pk": 6, - "fields": { "group": ["Moderators"], "page": 1, "permission_type": "lock" } + "fields": { + "group": ["Moderators"], + "page": 1, + "permission": ["lock_page", "wagtailcore", "page"] + } }, { "model": "wagtailcore.collection", From 06c9cb893ec272d3a1cfc5238b6c163dd633cca5 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Wed, 22 Nov 2023 10:51:40 +0800 Subject: [PATCH 03/45] Wagtail 5.1 upgrade consideration: insert_editor_css hook is deprecated --- bc/utils/wagtail_hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bc/utils/wagtail_hooks.py b/bc/utils/wagtail_hooks.py index 251404f2..148dca2a 100644 --- a/bc/utils/wagtail_hooks.py +++ b/bc/utils/wagtail_hooks.py @@ -161,7 +161,7 @@ def editor_js(): ) -@hooks.register("insert_editor_css") +@hooks.register("insert_global_admin_css") def editor_css(): return mark_safe( '' From 165b5edd91cc80e638365cb0ed35d33343193474 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Wed, 22 Nov 2023 11:04:16 +0800 Subject: [PATCH 04/45] Install wagtail-modeladmin --- poetry.lock | 20 +++++++++++++++++++- pyproject.toml | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index 43416657..bb52af9d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2303,6 +2303,24 @@ wagtail = ">=4.1" docs = ["sphinx (>=1.4.0)"] test = ["coverage (==6.0)", "flake8 (==4.0.0)", "flake8-blind-except (==0.1.1)", "flake8-debugger (==4.1.2)", "isort (==5.10.0)", "psycopg2 (>=2.3.1)", "pytest (==6.2.5)", "pytest-cov (==3.0.0)", "pytest-django (==4.5.0)", "pytest-pythonpath (==0.7.3)"] +[[package]] +name = "wagtail-modeladmin" +version = "1.0.0" +description = "Add any model in your project to the Wagtail admin. Formerly wagtail.contrib.modeladmin." +optional = false +python-versions = ">=3.8" +files = [ + {file = "wagtail_modeladmin-1.0.0-py3-none-any.whl", hash = "sha256:0d92dd012e17dd5b5d5058792c8549594884c87da7ef794e8f1765bb245a5340"}, + {file = "wagtail_modeladmin-1.0.0.tar.gz", hash = "sha256:da545ba34747bff01c942b8306e20ac17d8a64d1873734cc8cf7303716af93fc"}, +] + +[package.dependencies] +Wagtail = ">=5.0" + +[package.extras] +docs = ["Sphinx (>=6.0)", "myst_parser (>=0.18.1,<1.0)", "pyenchant (>=3.1.1,<4)", "sphinx-autobuild (>=0.6.0)", "sphinx-wagtail-theme (==6.0.0)", "sphinx_copybutton (>=0.5)", "sphinxcontrib-spelling (>=8.0,<9.0)"] +testing = ["dj-database-url (>=2.0.0)", "pre-commit (<3.0)"] + [[package]] name = "wagtail-orderable" version = "1.2.0" @@ -2503,4 +2521,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "6349c4303a6beaf1afdb1b4bbe040362163a5fab8fe878d9fca162257d3053e7" +content-hash = "060bf1f2544e43f877abaac76703d23fce1c317147f4f96179ab0c1469dd69d7" diff --git a/pyproject.toml b/pyproject.toml index b3d97b97..663ee8e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ sentry-sdk = "^1.19.1" backoff = "^2.2.1" responses = "0.16.0" django-filter = "^22.1" +wagtail-modeladmin = "^1.0.0" [tool.poetry.extras] gunicorn = ["gunicorn"] From 69ac9247a23adf5880d91e1875eaf62019b8977a Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Wed, 22 Nov 2023 11:07:28 +0800 Subject: [PATCH 05/45] Wagtail 5.1 upgrade consideration: wagtail.contrib.modeladmin is deprecated, Replace wagtail.contrib.modeladmin with the wagtail_modeladmin package --- bc/alerts/wagtail_hooks.py | 2 +- bc/blogs/wagtail_hooks.py | 7 ++----- bc/recruitment/wagtail_hooks.py | 7 ++----- bc/settings/base.py | 2 +- bc/utils/wagtail_hooks.py | 6 +----- 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/bc/alerts/wagtail_hooks.py b/bc/alerts/wagtail_hooks.py index 20943dc1..d25b21cc 100644 --- a/bc/alerts/wagtail_hooks.py +++ b/bc/alerts/wagtail_hooks.py @@ -1,4 +1,4 @@ -from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register +from wagtail_modeladmin.options import ModelAdmin, modeladmin_register from bc.alerts.models import Alert diff --git a/bc/blogs/wagtail_hooks.py b/bc/blogs/wagtail_hooks.py index c22cf467..fbdab8f9 100644 --- a/bc/blogs/wagtail_hooks.py +++ b/bc/blogs/wagtail_hooks.py @@ -1,11 +1,8 @@ from wagtail import hooks -from wagtail.contrib.modeladmin.options import ( - ModelAdmin, - ModelAdminGroup, - modeladmin_register, -) from wagtail.models import PageLogEntry +from wagtail_modeladmin.options import ModelAdmin, ModelAdminGroup, modeladmin_register + from bc.blogs.models import BlogAlertSubscription, BlogPostPage, NotificationRecord diff --git a/bc/recruitment/wagtail_hooks.py b/bc/recruitment/wagtail_hooks.py index 781fe4b3..1bf68989 100644 --- a/bc/recruitment/wagtail_hooks.py +++ b/bc/recruitment/wagtail_hooks.py @@ -1,12 +1,9 @@ from django.utils.html import format_html -from wagtail.contrib.modeladmin.options import ( - ModelAdmin, - ModelAdminGroup, - modeladmin_register, -) from wagtail.search.utils import OR +from wagtail_modeladmin.options import ModelAdmin, ModelAdminGroup, modeladmin_register + from bc.recruitment.models import JobAlertSubscription, TalentLinkJob diff --git a/bc/settings/base.py b/bc/settings/base.py index 6fbcda20..97e60c97 100644 --- a/bc/settings/base.py +++ b/bc/settings/base.py @@ -84,7 +84,7 @@ "wagtail_transfer", "rest_framework", "wagtailorderable", - "wagtail.contrib.modeladmin", + "wagtail_modeladmin", "wagtail.contrib.settings", "wagtail.contrib.search_promotions", "wagtail.contrib.forms", diff --git a/bc/utils/wagtail_hooks.py b/bc/utils/wagtail_hooks.py index 148dca2a..653c8a29 100644 --- a/bc/utils/wagtail_hooks.py +++ b/bc/utils/wagtail_hooks.py @@ -6,12 +6,8 @@ from wagtail.admin.menu import AdminOnlyMenuItem from wagtail.admin.rich_text.converters.html_to_contentstate import BlockElementHandler from wagtail.admin.rich_text.editors.draftail import features as draftail_features -from wagtail.contrib.modeladmin.options import ( - ModelAdmin, - ModelAdminGroup, - modeladmin_register, -) +from wagtail_modeladmin.options import ModelAdmin, ModelAdminGroup, modeladmin_register from wagtailorderable.modeladmin.mixins import OrderableMixin from bc.events.models import EventType From 886272b32c9364b2ef409d470dd6ea983caeef71 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Wed, 22 Nov 2023 11:22:29 +0800 Subject: [PATCH 06/45] Remove wagtail-transfer from forked Wagtail package dependencies --- docs/upgrading.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/upgrading.md b/docs/upgrading.md index de991f0b..6b9c3b29 100644 --- a/docs/upgrading.md +++ b/docs/upgrading.md @@ -37,6 +37,5 @@ A temporary solution is to fork the package dependency, tag the working branch, The following packages are forked at the time of the latest upgrade (Wagtail 5.0): - `wagtail-django-recaptcha` -- `wagtail-transfer` Please note that it is important to replace the usage of the git tags in the pyproject.toml file with the official release version from PyPI as soon as it becomes available. This ensures that we maintain compatibility with the official releases and benefit from any subsequent updates and improvements provided by the original package maintainers. From dc66e7f6d196537c2817152e65b438ae40b4e990 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 24 Nov 2023 11:04:36 +0800 Subject: [PATCH 07/45] Update wagtail-django-recaptcha to use latest forked tag --- poetry.lock | 6 +++--- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index bb52af9d..44d104a7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2281,8 +2281,8 @@ testing = ["coverage (>=6.5.0,<6.6)", "flake8 (>=5.0.4,<5.1)", "isort (>=5.10.1) [package.source] type = "git" url = "https://github.com/torchbox-forks/wagtail-django-recaptcha" -reference = "2.1.0" -resolved_reference = "23056b5d59fb42f7a531c9b0eb89edea419dd0bb" +reference = "2.1.1+tbx" +resolved_reference = "c23696f5c55824a8abd86e13f13da4a90d437d75" [[package]] name = "wagtail-factories" @@ -2521,4 +2521,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "060bf1f2544e43f877abaac76703d23fce1c317147f4f96179ab0c1469dd69d7" +content-hash = "2b94854e67419d23df765ef316ce3dd13bd6970f4d5fb6d9626bd0dec1c39737" diff --git a/pyproject.toml b/pyproject.toml index 663ee8e9..2312f329 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ scout-apm = "2.0.2" tabulate = "0.8.7" urllib3 = "1.26.11" wagtail = "~5.1" -wagtail-django-recaptcha = {git = "https://github.com/torchbox-forks/wagtail-django-recaptcha", tag = "2.1.0"} +wagtail-django-recaptcha = {git = "https://github.com/torchbox-forks/wagtail-django-recaptcha", tag = "2.1.1+tbx"} wagtail-factories = "^4.1.0" wagtail-orderable = "^1.2.0" wagtail-transfer = "^0.9.3" From ddd6721cb9611a5d1407c81e04efc09ba395b49c Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 24 Nov 2023 11:10:10 +0800 Subject: [PATCH 08/45] Update django-recaptcha to 4.0.0 --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 44d104a7..b0123fad 100644 --- a/poetry.lock +++ b/poetry.lock @@ -590,13 +590,13 @@ testing = ["django-modelcluster"] [[package]] name = "django-recaptcha" -version = "3.0.0" +version = "4.0.0" description = "Django recaptcha form field/widget app." optional = false python-versions = "*" files = [ - {file = "django-recaptcha-3.0.0.tar.gz", hash = "sha256:253197051288923cae675d7eff91b619e3775311292a5dbaf27a8a55ffebc670"}, - {file = "django_recaptcha-3.0.0-py3-none-any.whl", hash = "sha256:1aed69fd6ac8fd9e99e52665392ae6748f8b6339ace656fad779fe0c6c915a52"}, + {file = "django-recaptcha-4.0.0.tar.gz", hash = "sha256:5316438f97700c431d65351470d1255047e3f2cd9af0f2f13592b637dad9213e"}, + {file = "django_recaptcha-4.0.0-py3-none-any.whl", hash = "sha256:0d912d5c7c009df4e47accd25029133d47a74342dbd2a8edc2877b6bffa971a3"}, ] [package.dependencies] From 88f52cf2967d6704804a2675a0c7d4f927d0307c Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 24 Nov 2023 11:11:41 +0800 Subject: [PATCH 09/45] Replace captcha with django_recaptcha following the package namespace rename on django-recaptcha 4.0.0 --- bc/settings/base.py | 2 +- bc/settings/dev.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bc/settings/base.py b/bc/settings/base.py index 97e60c97..efdcf2bb 100644 --- a/bc/settings/base.py +++ b/bc/settings/base.py @@ -104,7 +104,7 @@ "wagtail", "modelcluster", "taggit", - "captcha", + "django_recaptcha", "wagtailcaptcha", "django.contrib.admin", "django.contrib.auth", diff --git a/bc/settings/dev.py b/bc/settings/dev.py index 905ca0b4..0c33a956 100644 --- a/bc/settings/dev.py +++ b/bc/settings/dev.py @@ -14,7 +14,7 @@ ALLOWED_HOSTS = ["*"] # Silence recapcha key warning -SILENCED_SYSTEM_CHECKS = ["captcha.recaptcha_test_key_error"] +SILENCED_SYSTEM_CHECKS = ["django_recaptcha.recaptcha_test_key_error"] # Allow requests from the local IPs to see more debug information. INTERNAL_IPS = ("127.0.0.1", "10.0.2.2") From 087fb4206742b98a90327c0210a0fbf25dd225e9 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 24 Nov 2023 11:12:33 +0800 Subject: [PATCH 10/45] Update Django to 3.2.23 --- poetry.lock | 8 ++++---- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/poetry.lock b/poetry.lock index b0123fad..5ca9197e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -424,13 +424,13 @@ files = [ [[package]] name = "django" -version = "3.2.20" +version = "3.2.23" description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." optional = false python-versions = ">=3.6" files = [ - {file = "Django-3.2.20-py3-none-any.whl", hash = "sha256:a477ab326ae7d8807dc25c186b951ab8c7648a3a23f9497763c37307a2b5ef87"}, - {file = "Django-3.2.20.tar.gz", hash = "sha256:dec2a116787b8e14962014bf78e120bba454135108e1af9e9b91ade7b2964c40"}, + {file = "Django-3.2.23-py3-none-any.whl", hash = "sha256:d48608d5f62f2c1e260986835db089fa3b79d6f58510881d316b8d88345ae6e1"}, + {file = "Django-3.2.23.tar.gz", hash = "sha256:82968f3640e29ef4a773af2c28448f5f7a08d001c6ac05b32d02aeee6509508b"}, ] [package.dependencies] @@ -2521,4 +2521,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "2b94854e67419d23df765ef316ce3dd13bd6970f4d5fb6d9626bd0dec1c39737" +content-hash = "70bb8395a013203f7b20d3e42bc117275c1aaa1117642b1a3ed7aed4178288f3" diff --git a/pyproject.toml b/pyproject.toml index 2312f329..4605e729 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ authors = ["Torchbox "] python = "~3.8" bleach = "3.1.0" dj-database-url = "0.5.0" -Django = "~3.2.20" +Django = "~3.2" django-basic-auth-ip-whitelist = "^0.3.4" django-birdbath = "^1.0.0" django-csp = "3.7" From d6120d295057998ed27dbb945e3fff676f60fb70 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Mon, 15 Jan 2024 15:51:20 +0800 Subject: [PATCH 11/45] Upgrade Wagtail to 5.2, upgrade Wagtail packages --- poetry.lock | 42 +++++++++++++++++++++--------------------- pyproject.toml | 4 ++-- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/poetry.lock b/poetry.lock index 5ca9197e..50d3f0f6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -510,13 +510,13 @@ six = ">=1.2" [[package]] name = "django-filter" -version = "22.1" +version = "23.5" description = "Django-filter is a reusable Django application for allowing users to filter querysets dynamically." optional = false python-versions = ">=3.7" files = [ - {file = "django-filter-22.1.tar.gz", hash = "sha256:ed473b76e84f7e83b2511bb2050c3efb36d135207d0128dfe3ae4b36e3594ba5"}, - {file = "django_filter-22.1-py3-none-any.whl", hash = "sha256:ed429e34760127e3520a67f415bec4c905d4649fbe45d0d6da37e6ff5e0287eb"}, + {file = "django-filter-23.5.tar.gz", hash = "sha256:67583aa43b91fe8c49f74a832d95f4d8442be628fd4c6d65e9f811f5153a4e5c"}, + {file = "django_filter-23.5-py3-none-any.whl", hash = "sha256:99122a201d83860aef4fe77758b69dda913e874cc5e0eaa50a86b0b18d708400"}, ] [package.dependencies] @@ -539,21 +539,21 @@ notifications-python-client = ">=6.1.0,<7.0.0" [[package]] name = "django-modelcluster" -version = "6.0" +version = "6.2.1" description = "Django extension to allow working with 'clusters' of models as a single unit, independently of the database" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "django-modelcluster-6.0.tar.gz", hash = "sha256:cdcffef5baf5d3759ee04c5b60ffaf1a0c95fc0f265e762f3ddfadde3394e5db"}, - {file = "django_modelcluster-6.0-py2.py3-none-any.whl", hash = "sha256:4ae46f86c43702020f24f212222eef0a2588df937bbb523a5447da247b5fb130"}, + {file = "django-modelcluster-6.2.1.tar.gz", hash = "sha256:3f53d47e1af7aec5e238724be16bbebdac9c518e4788b31429e773dcd8e8ea49"}, + {file = "django_modelcluster-6.2.1-py2.py3-none-any.whl", hash = "sha256:725c005de22191165b690ea05588b1c702ac34b1e9cd8a8b26fadc2a35fcd337"}, ] [package.dependencies] -django = ">=2.2" -pytz = ">=2015.2" +django = ">=3.2" +pytz = ">=2022.4" [package.extras] -taggit = ["django-taggit (>=0.20)"] +taggit = ["django-taggit (>=3.1)"] [[package]] name = "django-pattern-library" @@ -2231,21 +2231,21 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess [[package]] name = "wagtail" -version = "5.1.3" +version = "5.2.2" description = "A Django content management system." optional = false python-versions = ">=3.8" files = [ - {file = "wagtail-5.1.3-py3-none-any.whl", hash = "sha256:f4a6cc2adc40f687d8fb62fed2d4fc0804941dfa45b4624887f260dc6cf6b9f2"}, - {file = "wagtail-5.1.3.tar.gz", hash = "sha256:45fac794e4c20c7e75b018069d7f9761f25faa3619ef30df24013ca24abf9a74"}, + {file = "wagtail-5.2.2-py3-none-any.whl", hash = "sha256:b469a1b3cb3ab3e0c6a2c6f56b4a7890427609c0c12ca32322e26ab534547211"}, + {file = "wagtail-5.2.2.tar.gz", hash = "sha256:48e4c29b72b0e53eb47a3178d6b0f2c699aa284d3f3a2abfd2f04f578f44b55a"}, ] [package.dependencies] anyascii = ">=0.1.5" beautifulsoup4 = ">=4.8,<4.12" -Django = ">=3.2,<4.3" -django-filter = ">=2.2,<24" -django-modelcluster = ">=6.0,<7.0" +Django = ">=3.2,<5.1" +django-filter = ">=23.3,<24" +django-modelcluster = ">=6.1,<7.0" django-permissionedforms = ">=0.1,<1.0" django-taggit = ">=2.0,<5.0" django-treebeard = ">=4.5.1,<5.0" @@ -2261,7 +2261,7 @@ Willow = {version = ">=1.6.2,<1.7", extras = ["heif"]} [package.extras] docs = ["Sphinx (>=1.5.2)", "myst-parser (==0.18.1)", "pyenchant (>=3.1.1,<4)", "sphinx-autobuild (>=0.6.0)", "sphinx-copybutton (>=0.5,<1.0)", "sphinx-wagtail-theme (==6.1.1)", "sphinxcontrib-spelling (>=5.4.0,<6)"] -testing = ["Jinja2 (>=3.0,<3.2)", "azure-mgmt-cdn (>=12.0,<13.0)", "azure-mgmt-frontdoor (>=1.0,<1.1)", "black (==22.3.0)", "boto3 (>=1.16,<1.17)", "coverage (>=3.7.0)", "curlylint (==0.13.1)", "django-pattern-library (>=0.7,<0.8)", "djhtml (==1.5.2)", "doc8 (==0.8.1)", "factory-boy (>=3.2)", "freezegun (>=0.3.8)", "polib (>=1.1,<2.0)", "python-dateutil (>=2.7)", "pytz (>=2014.7)", "ruff (==0.0.272)", "semgrep (==1.3.0)"] +testing = ["Jinja2 (>=3.0,<3.2)", "azure-mgmt-cdn (>=12.0,<13.0)", "azure-mgmt-frontdoor (>=1.0,<1.1)", "black (==22.3.0)", "boto3 (>=1.28,<2)", "coverage (>=3.7.0)", "curlylint (==0.13.1)", "django-pattern-library (>=0.7,<0.8)", "djhtml (==1.5.2)", "doc8 (==0.8.1)", "factory-boy (>=3.2)", "freezegun (>=0.3.8)", "polib (>=1.1,<2.0)", "python-dateutil (>=2.7)", "pytz (>=2014.7)", "ruff (==0.0.290)", "semgrep (==1.40.0)", "tblib (>=2.0,<3.0)"] [[package]] name = "wagtail-django-recaptcha" @@ -2354,13 +2354,13 @@ docs = ["mkdocs (>=1.0,<1.1)", "mkdocs-material (>=4.6,<4.7)"] [[package]] name = "wagtailgeowidget" -version = "8.0.0" +version = "8.1.1" description = "Wagtail-Geo-Widget is the complete map solution for your Wagtail site." optional = false python-versions = "*" files = [ - {file = "wagtailgeowidget-8.0.0-py3-none-any.whl", hash = "sha256:59eb0c4261c3be92af5a8d3db006c374f38c8a0a84ae3b0b8de51c1370991810"}, - {file = "wagtailgeowidget-8.0.0.tar.gz", hash = "sha256:786bcac1fbb6d1ba8b1918d6292e5164394e8d269c102ae4ee411a18f664d07c"}, + {file = "wagtailgeowidget-8.1.1-py3-none-any.whl", hash = "sha256:30379aaf773762c36d139ababdf239ce77aa6514a1d80cbffcbdb5a495626b0e"}, + {file = "wagtailgeowidget-8.1.1.tar.gz", hash = "sha256:3fbf83da821c787a3dae03885861e96a89e0cf0dd680b0ac158a4d8a55c5e7ec"}, ] [package.dependencies] @@ -2521,4 +2521,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "70bb8395a013203f7b20d3e42bc117275c1aaa1117642b1a3ed7aed4178288f3" +content-hash = "81348748e4674fa47df5a9481517d85ad975864a142588c58345134fb882f833" diff --git a/pyproject.toml b/pyproject.toml index 4605e729..ad840686 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,12 +27,12 @@ redis = "2.10.6" scout-apm = "2.0.2" tabulate = "0.8.7" urllib3 = "1.26.11" -wagtail = "~5.1" +wagtail = "~5.2" wagtail-django-recaptcha = {git = "https://github.com/torchbox-forks/wagtail-django-recaptcha", tag = "2.1.1+tbx"} wagtail-factories = "^4.1.0" wagtail-orderable = "^1.2.0" wagtail-transfer = "^0.9.3" -wagtailgeowidget = "8.0.0" +wagtailgeowidget = "8.1.1" whitenoise = "5.0" zeep = "3.4.0" sentry-sdk = "^1.19.1" From f9cb8216972ee5b49502798ac8ec77b73b454e54 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 14:46:48 +0800 Subject: [PATCH 12/45] Upgrade django-filter: wagtail (5.2.2) depends on django-filter (>=23.3,<24) --- poetry.lock | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/poetry.lock b/poetry.lock index 50d3f0f6..eec62648 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2521,4 +2521,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "81348748e4674fa47df5a9481517d85ad975864a142588c58345134fb882f833" +content-hash = "e7bfea36e135f1c787c14d6a58ca267dd0da7e6287a87380a2e39d6f0d6f5792" diff --git a/pyproject.toml b/pyproject.toml index ad840686..2be5946c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ zeep = "3.4.0" sentry-sdk = "^1.19.1" backoff = "^2.2.1" responses = "0.16.0" -django-filter = "^22.1" +django-filter = "^23.5" wagtail-modeladmin = "^1.0.0" [tool.poetry.extras] From beb812f5fac0f567f6d022a22c6fa5bd97a097b5 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Mon, 15 Jan 2024 15:52:15 +0800 Subject: [PATCH 13/45] Wagtail 5.2 upgrade consideration: Adoption of classname convention for MenuItem related classes and hooks --- bc/feedback/wagtail_hooks.py | 4 ++-- bc/utils/wagtail_hooks.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bc/feedback/wagtail_hooks.py b/bc/feedback/wagtail_hooks.py index b99090d5..d5d67156 100644 --- a/bc/feedback/wagtail_hooks.py +++ b/bc/feedback/wagtail_hooks.py @@ -11,7 +11,7 @@ def register_usefulness_feedback_report_menu_item(): return menu.MenuItem( UsefulnessFeedbackReportView.title, urls.reverse("usefuleness_feedback_report"), - classnames="icon icon-" + UsefulnessFeedbackReportView.header_icon, + classname="icon icon-" + UsefulnessFeedbackReportView.header_icon, order=300, ) @@ -32,7 +32,7 @@ def register_feedback_comment_report_menu_item(): return menu.MenuItem( FeedbackCommentReportView.title, urls.reverse("feedback_comment_report"), - classnames="icon icon-" + FeedbackCommentReportView.header_icon, + classname="icon icon-" + FeedbackCommentReportView.header_icon, order=400, ) diff --git a/bc/utils/wagtail_hooks.py b/bc/utils/wagtail_hooks.py index 653c8a29..7a19b3b5 100644 --- a/bc/utils/wagtail_hooks.py +++ b/bc/utils/wagtail_hooks.py @@ -81,7 +81,7 @@ def register_unpublished_changes_report_menu_item(): return AdminOnlyMenuItem( "Pages with unpublished changes", reverse("unpublished_changes_report"), - classnames="icon icon-" + UnpublishedChangesReportView.header_icon, + classname="icon icon-" + UnpublishedChangesReportView.header_icon, order=700, ) @@ -102,7 +102,7 @@ def register_missing_metadata_report_menu_item(): return AdminOnlyMenuItem( "Pages with missing metadata", reverse("missing_metadata_report"), - classnames="icon icon-" + MissingMetadataReportView.header_icon, + classname="icon icon-" + MissingMetadataReportView.header_icon, order=700, ) From b0e19a144dd6a0bb33f5853551e5812f28a43e3a Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Mon, 15 Jan 2024 16:01:27 +0800 Subject: [PATCH 14/45] Update upgrading.md --- docs/upgrading.md | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/docs/upgrading.md b/docs/upgrading.md index 6b9c3b29..0c26de49 100644 --- a/docs/upgrading.md +++ b/docs/upgrading.md @@ -2,6 +2,25 @@ This document describes aspects of the system which should be given particular attention when upgrading Wagtail or its dependencies. +## Wagtail package dependencies + +We are maintaining our own forks of Wagtail packages at: . + +The enables any team member to propose a change to a package, we can all work directly on the work branch and submit it to the original author for consideration. + +- [How we work on forked packages (intranet article).](https://intranet.torchbox.com/torchbox-teams/tech-team/working-with-3rd-party-packages/#forking-repositories) +- [Where we manage forked packages (Monday board).](https://torchbox.monday.com/boards/1124794299) + +As much as possible, we want to use the official releases available on PyPI for the Wagtail package dependencies. A temporary solution is to fork the package dependency, tag the working branch, and use the tag in the pyproject file. + +### Check these packages for updates + +**Last tested for wagtail 5.2 upgrade** Comments in the pyproject.toml file may have more detailed information. + +- wagtail-django-recaptcha + +It is important to replace the usage of the git tags in the pyproject.toml file with the official release version from PyPI as soon as they become available. + ## Critical paths The following areas of functionality are critical paths for the site which don't have full automated tests and should be checked manually. @@ -26,16 +45,3 @@ As well as testing the critical paths, these areas of functionality should be ch - This could be code which you know should be checked and possibly removed - e.g. because you've patched something until a fix is merged in a subsequent release. - Any previous fixes which may need to be updated/reapplied on subsequent upgrades - Technical debt which could be affected by an upgrade. - -## Forked Wagtail package dependencies - -As much as possible, we want to use the official releases available on PyPI for the Wagtail package dependencies. - -However, in certain situations, critical fixes and upgrades may be pending approval, merging, or release. -A temporary solution is to fork the package dependency, tag the working branch, and use the tag in the pyproject file. - -The following packages are forked at the time of the latest upgrade (Wagtail 5.0): - -- `wagtail-django-recaptcha` - -Please note that it is important to replace the usage of the git tags in the pyproject.toml file with the official release version from PyPI as soon as it becomes available. This ensures that we maintain compatibility with the official releases and benefit from any subsequent updates and improvements provided by the original package maintainers. From 6e7df4a50d771bf3b4df8b55e6debb3201c8c304 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 14:55:14 +0800 Subject: [PATCH 15/45] Bump Wagtail to 5.2.3 --- poetry.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index eec62648..62160e17 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2231,13 +2231,13 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess [[package]] name = "wagtail" -version = "5.2.2" +version = "5.2.3" description = "A Django content management system." optional = false python-versions = ">=3.8" files = [ - {file = "wagtail-5.2.2-py3-none-any.whl", hash = "sha256:b469a1b3cb3ab3e0c6a2c6f56b4a7890427609c0c12ca32322e26ab534547211"}, - {file = "wagtail-5.2.2.tar.gz", hash = "sha256:48e4c29b72b0e53eb47a3178d6b0f2c699aa284d3f3a2abfd2f04f578f44b55a"}, + {file = "wagtail-5.2.3-py3-none-any.whl", hash = "sha256:7b186b37ba044fd68c1a3c584ac0d913daa4ea95b95aa4c80412e4a0cb04e563"}, + {file = "wagtail-5.2.3.tar.gz", hash = "sha256:ad64595124c84c4b00b73b863029a7722e06b4dba17b76177d2f4944f579bca7"}, ] [package.dependencies] @@ -2256,7 +2256,7 @@ l18n = ">=2018.5" openpyxl = ">=3.0.10,<4.0" Pillow = ">=9.1.0,<11.0.0" requests = ">=2.11.1,<3.0" -telepath = ">=0.1.1,<1" +telepath = ">=0.3.1,<1" Willow = {version = ">=1.6.2,<1.7", extras = ["heif"]} [package.extras] From e0dec2bb021f4ccccfe6b071c6e897ac615c902a Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 15:13:38 +0800 Subject: [PATCH 16/45] Upgrade to Django ~4.0 --- poetry.lock | 106 ++++++++++++++++++++++++++++++++++--------------- pyproject.toml | 10 ++--- 2 files changed, 78 insertions(+), 38 deletions(-) diff --git a/poetry.lock b/poetry.lock index 62160e17..f14d6cc3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -93,6 +93,34 @@ files = [ {file = "backoff-2.2.1.tar.gz", hash = "sha256:03f829f5bb1923180821643f8753b0502c3b682293992485b0eef2807afa5cba"}, ] +[[package]] +name = "backports-zoneinfo" +version = "0.2.1" +description = "Backport of the standard library zoneinfo module" +optional = false +python-versions = ">=3.6" +files = [ + {file = "backports.zoneinfo-0.2.1-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:da6013fd84a690242c310d77ddb8441a559e9cb3d3d59ebac9aca1a57b2e18bc"}, + {file = "backports.zoneinfo-0.2.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:89a48c0d158a3cc3f654da4c2de1ceba85263fafb861b98b59040a5086259722"}, + {file = "backports.zoneinfo-0.2.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:1c5742112073a563c81f786e77514969acb58649bcdf6cdf0b4ed31a348d4546"}, + {file = "backports.zoneinfo-0.2.1-cp36-cp36m-win32.whl", hash = "sha256:e8236383a20872c0cdf5a62b554b27538db7fa1bbec52429d8d106effbaeca08"}, + {file = "backports.zoneinfo-0.2.1-cp36-cp36m-win_amd64.whl", hash = "sha256:8439c030a11780786a2002261569bdf362264f605dfa4d65090b64b05c9f79a7"}, + {file = "backports.zoneinfo-0.2.1-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:f04e857b59d9d1ccc39ce2da1021d196e47234873820cbeaad210724b1ee28ac"}, + {file = "backports.zoneinfo-0.2.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:17746bd546106fa389c51dbea67c8b7c8f0d14b5526a579ca6ccf5ed72c526cf"}, + {file = "backports.zoneinfo-0.2.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:5c144945a7752ca544b4b78c8c41544cdfaf9786f25fe5ffb10e838e19a27570"}, + {file = "backports.zoneinfo-0.2.1-cp37-cp37m-win32.whl", hash = "sha256:e55b384612d93be96506932a786bbcde5a2db7a9e6a4bb4bffe8b733f5b9036b"}, + {file = "backports.zoneinfo-0.2.1-cp37-cp37m-win_amd64.whl", hash = "sha256:a76b38c52400b762e48131494ba26be363491ac4f9a04c1b7e92483d169f6582"}, + {file = "backports.zoneinfo-0.2.1-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:8961c0f32cd0336fb8e8ead11a1f8cd99ec07145ec2931122faaac1c8f7fd987"}, + {file = "backports.zoneinfo-0.2.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e81b76cace8eda1fca50e345242ba977f9be6ae3945af8d46326d776b4cf78d1"}, + {file = "backports.zoneinfo-0.2.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:7b0a64cda4145548fed9efc10322770f929b944ce5cee6c0dfe0c87bf4c0c8c9"}, + {file = "backports.zoneinfo-0.2.1-cp38-cp38-win32.whl", hash = "sha256:1b13e654a55cd45672cb54ed12148cd33628f672548f373963b0bff67b217328"}, + {file = "backports.zoneinfo-0.2.1-cp38-cp38-win_amd64.whl", hash = "sha256:4a0f800587060bf8880f954dbef70de6c11bbe59c673c3d818921f042f9954a6"}, + {file = "backports.zoneinfo-0.2.1.tar.gz", hash = "sha256:fadbfe37f74051d024037f223b8e001611eac868b5c5b06144ef4d8b799862f2"}, +] + +[package.extras] +tzdata = ["tzdata"] + [[package]] name = "beautifulsoup4" version = "4.11.2" @@ -424,19 +452,20 @@ files = [ [[package]] name = "django" -version = "3.2.23" -description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." +version = "4.0.10" +description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design." optional = false -python-versions = ">=3.6" +python-versions = ">=3.8" files = [ - {file = "Django-3.2.23-py3-none-any.whl", hash = "sha256:d48608d5f62f2c1e260986835db089fa3b79d6f58510881d316b8d88345ae6e1"}, - {file = "Django-3.2.23.tar.gz", hash = "sha256:82968f3640e29ef4a773af2c28448f5f7a08d001c6ac05b32d02aeee6509508b"}, + {file = "Django-4.0.10-py3-none-any.whl", hash = "sha256:4496eb4f65071578b703fdc6e6f29302553c7440e3f77baf4cefa4a4e091fc3d"}, + {file = "Django-4.0.10.tar.gz", hash = "sha256:2c2f73c16b11cb272c6d5e3b063f0d1be06f378d8dc6005fbe8542565db659cc"}, ] [package.dependencies] -asgiref = ">=3.3.2,<4" -pytz = "*" +asgiref = ">=3.4.1,<4" +"backports.zoneinfo" = {version = "*", markers = "python_version < \"3.9\""} sqlparse = ">=0.2.2" +tzdata = {version = "*", markers = "sys_platform == \"win32\""} [package.extras] argon2 = ["argon2-cffi (>=19.1.0)"] @@ -444,20 +473,20 @@ bcrypt = ["bcrypt"] [[package]] name = "django-basic-auth-ip-whitelist" -version = "0.3.4" +version = "0.5" description = "Hide your Django site behind basic authentication mechanism with IP whitelisting support." optional = false python-versions = ">=3.4" files = [ - {file = "django-basic-auth-ip-whitelist-0.3.4.tar.gz", hash = "sha256:b148082b336e276f328b4cad48744f160469bfc34e8f5bac0ef449abc297bc4e"}, - {file = "django_basic_auth_ip_whitelist-0.3.4-py3-none-any.whl", hash = "sha256:9d20210755b4a2db069326cedafa589453386cebe147ed0a9f1f9b55da927b02"}, + {file = "django-basic-auth-ip-whitelist-0.5.tar.gz", hash = "sha256:8e859303a802574a121a1787bdf96ca2c16140bb9003da96e28323e7a80d99fc"}, + {file = "django_basic_auth_ip_whitelist-0.5-py3-none-any.whl", hash = "sha256:c64cc3e1bbf736d5e6d6c3468c16003cfc4d01cdfb92cd9e7bbe9fbcd5bdf9be"}, ] [package.dependencies] -Django = ">=1.8,<4" +Django = ">=1.8,<5" [package.extras] -lint = ["black (==19.10b0)", "flake8 (==3.8.3)", "isort (==4.3.21)"] +lint = ["black (==20.8b1)", "flake8 (==3.8.4)", "isort (==5.7.0)"] [[package]] name = "django-birdbath" @@ -496,17 +525,17 @@ tests = ["jinja2 (>=2.9.6)", "mock (==1.0.1)", "pep8 (==1.4.6)", "pytest (<4.0)" [[package]] name = "django-extensions" -version = "2.1.6" +version = "3.2.3" description = "Extensions for Django" optional = false -python-versions = "*" +python-versions = ">=3.6" files = [ - {file = "django-extensions-2.1.6.tar.gz", hash = "sha256:307766e5e6c1caffe76c5d99239d8115d14ae3f7cab2cd991fcffd763dad904b"}, - {file = "django_extensions-2.1.6-py2.py3-none-any.whl", hash = "sha256:109004f80b6f45ad1f56addaa59debca91d94aa0dc1cb19678b9364b4fe9b6f4"}, + {file = "django-extensions-3.2.3.tar.gz", hash = "sha256:44d27919d04e23b3f40231c4ab7af4e61ce832ef46d610cc650d53e68328410a"}, + {file = "django_extensions-3.2.3-py3-none-any.whl", hash = "sha256:9600b7562f79a92cbf1fde6403c04fee314608fefbb595502e34383ae8203401"}, ] [package.dependencies] -six = ">=1.2" +Django = ">=3.2" [[package]] name = "django-filter" @@ -524,18 +553,18 @@ Django = ">=3.2" [[package]] name = "django-gov-notify" -version = "0.3.0" +version = "0.4.0" description = "A GOV.UK Notify flavoured Django email backend" optional = false -python-versions = ">=3.6.1,<3.10" +python-versions = ">=3.8,<3.12" files = [ - {file = "django-gov-notify-0.3.0.tar.gz", hash = "sha256:5ea110762a379d69fb51c28f68ca9d8d8ef33ed1dd12f161eff4bc3dc7326faf"}, - {file = "django_gov_notify-0.3.0-py3-none-any.whl", hash = "sha256:de275ba19dcf8d2128cfe9cf8e91d2ed31fc86c3878b181be35026fdc56f2f52"}, + {file = "django_gov_notify-0.4.0-py3-none-any.whl", hash = "sha256:228c289f77f8f027b65c52e26bbcbaa856f0ae5e80f7d6b625d7768ddaf33d11"}, + {file = "django_gov_notify-0.4.0.tar.gz", hash = "sha256:393852a4c4e6223aa07631432b103e42ad2c9765cc7c6069febfb7ba659402bb"}, ] [package.dependencies] -django = ">=2.2.12,<4.0" -notifications-python-client = ">=6.1.0,<7.0.0" +django = ">=3.2,<5.0" +notifications-python-client = ">=8.1.0,<9.0.0" [[package]] name = "django-modelcluster" @@ -557,19 +586,19 @@ taggit = ["django-taggit (>=3.1)"] [[package]] name = "django-pattern-library" -version = "0.5.0" +version = "1.2.0" description = "A module for Django that allows to build pattern libraries for your projects." optional = false -python-versions = ">=3.6,<4.0" +python-versions = ">=3.8,<4.0" files = [ - {file = "django-pattern-library-0.5.0.tar.gz", hash = "sha256:25210194de8fe4c0c2a969e7ffbcea81efad19a7ac843bd67d28d39e26568545"}, - {file = "django_pattern_library-0.5.0-py3-none-any.whl", hash = "sha256:bd387f104652c26ce05e7d3cd884d134819c7757c0caa1107a3be3a05eda552d"}, + {file = "django_pattern_library-1.2.0-py3-none-any.whl", hash = "sha256:7fa75d7a4251c08562fd6ec4bbb485bf12e1952d3ff12ba5692f35950be767a5"}, + {file = "django_pattern_library-1.2.0.tar.gz", hash = "sha256:dd4ce104947bbfc7e227873afe442da9e961c68663f7b8fe50d16fc86ba906b3"}, ] [package.dependencies] -Django = ">=2.2,<4.0" +Django = ">=3.2,<5.1" Markdown = ">=3.1,<4.0" -PyYAML = ">=5.1,<6.0" +PyYAML = ">=5.1,<7.0" [[package]] name = "django-permissionedforms" @@ -1384,12 +1413,12 @@ setuptools = "*" [[package]] name = "notifications-python-client" -version = "6.4.1" +version = "8.2.0" description = "Python API client for GOV.UK Notify." optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" files = [ - {file = "notifications_python_client-6.4.1-py2.py3-none-any.whl", hash = "sha256:10b51f47aaebce7eaf0838f06def8660859ce8321bd0b180934e26895dae08df"}, + {file = "notifications_python_client-8.2.0-py3-none-any.whl", hash = "sha256:8cd8bd01ae603a972a5413c430ca42b16f6481f37d98406c3e9b68c1c192f59e"}, ] [package.dependencies] @@ -2193,6 +2222,17 @@ files = [ {file = "typing_extensions-4.7.1.tar.gz", hash = "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"}, ] +[[package]] +name = "tzdata" +version = "2024.1" +description = "Provider of IANA time zone data" +optional = false +python-versions = ">=2" +files = [ + {file = "tzdata-2024.1-py2.py3-none-any.whl", hash = "sha256:9068bc196136463f5245e51efda838afa15aaeca9903f49050dfa2679db4d252"}, + {file = "tzdata-2024.1.tar.gz", hash = "sha256:2674120f8d891909751c38abcdfd386ac0a5a1127954fbc332af6b5ceae07efd"}, +] + [[package]] name = "urllib3" version = "1.26.11" @@ -2521,4 +2561,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "e7bfea36e135f1c787c14d6a58ca267dd0da7e6287a87380a2e39d6f0d6f5792" +content-hash = "52586a2a21b7d361f73f7cd457cec7ed9a55926c5d9a74dfc3496fe0ed27d4e0" diff --git a/pyproject.toml b/pyproject.toml index 2be5946c..3a08b254 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,12 +8,12 @@ authors = ["Torchbox "] python = "~3.8" bleach = "3.1.0" dj-database-url = "0.5.0" -Django = "~3.2" -django-basic-auth-ip-whitelist = "^0.3.4" +Django = "~4.0" +django-basic-auth-ip-whitelist = "^0.5" django-birdbath = "^1.0.0" django-csp = "3.7" -django-gov-notify = "^0.3.0" -django-pattern-library = "0.5" +django-gov-notify = "^0.4.0" +django-pattern-library = "~1.2.0" django-redis = "4.11.0" django-referrer-policy = "1.0" django-storages = {version = "1.9.1", extras = ["boto3"]} @@ -66,7 +66,7 @@ SQLAlchemy = "1.2.5" SQLAlchemy-Utils = "0.33.1" # Development dependencies -django-extensions = "2.1.6" +django-extensions = "~3.2" honcho = "^1.1.0" pre-commit = "1.16.1" Werkzeug = "0.14.1" From 91187cb6694d54d4dfe65e8793591a0d779df2f7 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 15:22:45 +0800 Subject: [PATCH 17/45] Add migration files from Django 4.0 --- bc/news/migrations/0033_django_40_upgrade.py | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 bc/news/migrations/0033_django_40_upgrade.py diff --git a/bc/news/migrations/0033_django_40_upgrade.py b/bc/news/migrations/0033_django_40_upgrade.py new file mode 100644 index 00000000..3a01d45e --- /dev/null +++ b/bc/news/migrations/0033_django_40_upgrade.py @@ -0,0 +1,23 @@ +# Generated by Django 4.0.10 on 2024-02-23 07:21 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("news", "0032_tableblock_help_text"), + ] + + operations = [ + migrations.AlterField( + model_name="newspagenewstype", + name="news_type", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="+", + to="news.newstype", + ), + ), + ] From 0a9ad8cd9349d7bff1fcb2d0025a5f76a431675b Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 15:23:04 +0800 Subject: [PATCH 18/45] Update Django 4.0 code --- bc/settings/base.py | 1 - bc/urls.py | 4 ++-- bc/users/__init__.py | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/bc/settings/base.py b/bc/settings/base.py index efdcf2bb..c7677ea2 100644 --- a/bc/settings/base.py +++ b/bc/settings/base.py @@ -277,7 +277,6 @@ USE_I18N = True -USE_L10N = True USE_TZ = True diff --git a/bc/urls.py b/bc/urls.py index 61d0b9df..0cce9eaa 100644 --- a/bc/urls.py +++ b/bc/urls.py @@ -1,7 +1,7 @@ from django.apps import apps from django.conf import settings from django.contrib import admin -from django.urls import include, path, re_path +from django.urls import include, path from django.views.decorators.vary import vary_on_headers from django.views.generic import TemplateView @@ -37,7 +37,7 @@ JobAlertUnsubscribeView.as_view(), name="unsubscribe_job_alert", ), - re_path(r"^wagtail-transfer/", include(wagtailtransfer_urls)), + path("wagtail-transfer/", include(wagtailtransfer_urls)), ] diff --git a/bc/users/__init__.py b/bc/users/__init__.py index e46f0eb1..e69de29b 100644 --- a/bc/users/__init__.py +++ b/bc/users/__init__.py @@ -1 +0,0 @@ -default_app_config = "bc.users.apps.UsersConfig" From 89e53ef1055c64708dce078bab3328ac8fe72fed Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 15:28:39 +0800 Subject: [PATCH 19/45] Upgrade to Django ~4.1 --- poetry.lock | 10 +++++----- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/poetry.lock b/poetry.lock index f14d6cc3..ae3f9f0b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -452,17 +452,17 @@ files = [ [[package]] name = "django" -version = "4.0.10" +version = "4.1.13" description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design." optional = false python-versions = ">=3.8" files = [ - {file = "Django-4.0.10-py3-none-any.whl", hash = "sha256:4496eb4f65071578b703fdc6e6f29302553c7440e3f77baf4cefa4a4e091fc3d"}, - {file = "Django-4.0.10.tar.gz", hash = "sha256:2c2f73c16b11cb272c6d5e3b063f0d1be06f378d8dc6005fbe8542565db659cc"}, + {file = "Django-4.1.13-py3-none-any.whl", hash = "sha256:04ab3f6f46d084a0bba5a2c9a93a3a2eb3fe81589512367a75f79ee8acf790ce"}, + {file = "Django-4.1.13.tar.gz", hash = "sha256:94a3f471e833c8f124ee7a2de11e92f633991d975e3fa5bdd91e8abd66426318"}, ] [package.dependencies] -asgiref = ">=3.4.1,<4" +asgiref = ">=3.5.2,<4" "backports.zoneinfo" = {version = "*", markers = "python_version < \"3.9\""} sqlparse = ">=0.2.2" tzdata = {version = "*", markers = "sys_platform == \"win32\""} @@ -2561,4 +2561,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "52586a2a21b7d361f73f7cd457cec7ed9a55926c5d9a74dfc3496fe0ed27d4e0" +content-hash = "ff1a9b2b5e7b3c674178b4341bb2912ec69c4598eecbaf3d6aa0c8f2b8003242" diff --git a/pyproject.toml b/pyproject.toml index 3a08b254..02f33c0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ authors = ["Torchbox "] python = "~3.8" bleach = "3.1.0" dj-database-url = "0.5.0" -Django = "~4.0" +Django = "~4.1" django-basic-auth-ip-whitelist = "^0.5" django-birdbath = "^1.0.0" django-csp = "3.7" From 96e52a8aaabbb9aaca877644c47354baca9fa5ba Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 15:34:43 +0800 Subject: [PATCH 20/45] Upgrade to Django ~4.2 --- poetry.lock | 12 ++++++------ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/poetry.lock b/poetry.lock index ae3f9f0b..22eef170 100644 --- a/poetry.lock +++ b/poetry.lock @@ -452,19 +452,19 @@ files = [ [[package]] name = "django" -version = "4.1.13" +version = "4.2.10" description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design." optional = false python-versions = ">=3.8" files = [ - {file = "Django-4.1.13-py3-none-any.whl", hash = "sha256:04ab3f6f46d084a0bba5a2c9a93a3a2eb3fe81589512367a75f79ee8acf790ce"}, - {file = "Django-4.1.13.tar.gz", hash = "sha256:94a3f471e833c8f124ee7a2de11e92f633991d975e3fa5bdd91e8abd66426318"}, + {file = "Django-4.2.10-py3-none-any.whl", hash = "sha256:a2d4c4d4ea0b6f0895acde632071aff6400bfc331228fc978b05452a0ff3e9f1"}, + {file = "Django-4.2.10.tar.gz", hash = "sha256:b1260ed381b10a11753c73444408e19869f3241fc45c985cd55a30177c789d13"}, ] [package.dependencies] -asgiref = ">=3.5.2,<4" +asgiref = ">=3.6.0,<4" "backports.zoneinfo" = {version = "*", markers = "python_version < \"3.9\""} -sqlparse = ">=0.2.2" +sqlparse = ">=0.3.1" tzdata = {version = "*", markers = "sys_platform == \"win32\""} [package.extras] @@ -2561,4 +2561,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "ff1a9b2b5e7b3c674178b4341bb2912ec69c4598eecbaf3d6aa0c8f2b8003242" +content-hash = "2f6ac600eb9f46b5da4e47cdd60552271792e9c62730877019804b0047651320" diff --git a/pyproject.toml b/pyproject.toml index 02f33c0f..d6c4dd4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ authors = ["Torchbox "] python = "~3.8" bleach = "3.1.0" dj-database-url = "0.5.0" -Django = "~4.1" +Django = "~4.2" django-basic-auth-ip-whitelist = "^0.5" django-birdbath = "^1.0.0" django-csp = "3.7" From a6dc46d5ad57aef637235177225ac788fb02afb0 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 15:35:20 +0800 Subject: [PATCH 21/45] Add migration files from Django 4.2 --- .../migrations/0006_django_42_upgrade.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 bc/images/migrations/0006_django_42_upgrade.py diff --git a/bc/images/migrations/0006_django_42_upgrade.py b/bc/images/migrations/0006_django_42_upgrade.py new file mode 100644 index 00000000..d3499ec9 --- /dev/null +++ b/bc/images/migrations/0006_django_42_upgrade.py @@ -0,0 +1,25 @@ +# Generated by Django 4.2.10 on 2024-02-23 07:34 + +from django.db import migrations + +import wagtail.images.models + + +class Migration(migrations.Migration): + + dependencies = [ + ("images", "0005_wagtail42_image"), + ] + + operations = [ + migrations.AlterField( + model_name="rendition", + name="file", + field=wagtail.images.models.WagtailImageField( + height_field="height", + storage=wagtail.images.models.get_rendition_storage, + upload_to=wagtail.images.models.get_rendition_upload_to, + width_field="width", + ), + ), + ] From 04956331e28a7e22707a980f62c219d5abdc1bf1 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 15:36:03 +0800 Subject: [PATCH 22/45] Update Django code according to v4.2 release notes --- bc/recruitment/tests/test_views.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bc/recruitment/tests/test_views.py b/bc/recruitment/tests/test_views.py index e6c5f4b3..081c5fbf 100644 --- a/bc/recruitment/tests/test_views.py +++ b/bc/recruitment/tests/test_views.py @@ -53,7 +53,7 @@ def test_internal_key_var(self): title="lock picker", homepage=self.homepage_internal ) resp = self.client.get( - job.application_url, HTTP_HOST=self.site_internal.hostname + ":80" + job.application_url, headers={"host": self.site_internal.hostname + ":80"} ) self.assertEqual(resp.status_code, 200) @@ -77,7 +77,7 @@ def test_external_key_var(self): title="sausage stuffer", homepage=self.homepage ) resp = self.client.get( - job.application_url, HTTP_HOST=self.site.hostname + ":80" + job.application_url, headers={"host": self.site.hostname + ":80"} ) self.assertEqual(resp.status_code, 200) @@ -108,7 +108,7 @@ def test_404_when_job_id_is_badly_formatted(self): + self.homepage.reverse_subpage("apply") + "?jobId=" + str(job_id), - HTTP_HOST=self.site.hostname + ":80", + headers={"host": self.site.hostname + ":80"} ) self.assertEqual(resp.status_code, 404) @@ -132,7 +132,7 @@ def test_view_when_job_id_does_not_exist(self): + self.homepage.reverse_subpage("apply") + "?jobId=" + str(job_id), - HTTP_HOST=self.site.hostname + ":80", + headers={"host": self.site.hostname + ":80"} ) self.assertEqual(resp.status_code, 200) @@ -150,7 +150,7 @@ def test_sidebar_normally_shown(self): title="puncture patcher", homepage=self.homepage ) resp = self.client.get( - job.application_url, HTTP_HOST=self.site.hostname + ":80" + job.application_url, headers={"host": self.site.hostname + ":80"} ) self.assertEqual(resp.status_code, 200) @@ -170,7 +170,7 @@ def test_sidebar_not_shown_when_job_id_does_not_exist(self): self.homepage.full_url + self.homepage.reverse_subpage("apply") + "?jobId=abc-123", - HTTP_HOST=self.site.hostname + ":80", + headers={"host": self.site.hostname + ":80"} ) self.assertEqual(resp.status_code, 200) self.assertEqual(resp.context["show_sidebar"], False) From e4c7ccfb4b77de5c6f03ff9a61c5b37e2e7000b0 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 15:44:18 +0800 Subject: [PATCH 23/45] Upgrade other Django-related packages --- poetry.lock | 254 +++++++++++++++++++++++++++++++++++++++---------- pyproject.toml | 15 ++- 2 files changed, 209 insertions(+), 60 deletions(-) diff --git a/poetry.lock b/poetry.lock index 22eef170..7c174024 100644 --- a/poetry.lock +++ b/poetry.lock @@ -64,6 +64,17 @@ files = [ [package.dependencies] pyyaml = "*" +[[package]] +name = "async-timeout" +version = "4.0.3" +description = "Timeout context manager for asyncio programs" +optional = false +python-versions = ">=3.7" +files = [ + {file = "async-timeout-4.0.3.tar.gz", hash = "sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f"}, + {file = "async_timeout-4.0.3-py3-none-any.whl", hash = "sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028"}, +] + [[package]] name = "attrs" version = "23.1.0" @@ -490,17 +501,17 @@ lint = ["black (==20.8b1)", "flake8 (==3.8.4)", "isort (==5.7.0)"] [[package]] name = "django-birdbath" -version = "1.1.0" +version = "1.1.1" description = "" optional = false python-versions = ">=3.6" files = [ - {file = "django-birdbath-1.1.0.tar.gz", hash = "sha256:94e1ab19e75834642cc0c906036d752a2b361c5ffce7eb96ebcfe0296977261d"}, - {file = "django_birdbath-1.1.0-py3-none-any.whl", hash = "sha256:ad99365e61c5846f64404f82462793cfd5fb402752bfe59d25745d5c4358b83d"}, + {file = "django-birdbath-1.1.1.tar.gz", hash = "sha256:a0fa85496009a1611166e19c075cd765beed700d2c9b0cc598172ef6e67ea8fa"}, + {file = "django_birdbath-1.1.1-py3-none-any.whl", hash = "sha256:e717bd057ca9e0a19b88c52f21f32c2246db7f0a0f1c8d8f3303ba0c4b6735ca"}, ] [package.dependencies] -Faker = ">=8,<14" +Faker = ">=8" [package.extras] dev = ["black (==23.1.0)", "flake8 (==6.0.0)", "isort (==5.12.0)"] @@ -633,18 +644,21 @@ django = "*" [[package]] name = "django-redis" -version = "4.11.0" +version = "5.4.0" description = "Full featured redis cache backend for Django." optional = false -python-versions = ">=3.5" +python-versions = ">=3.6" files = [ - {file = "django-redis-4.11.0.tar.gz", hash = "sha256:a5b1e3ffd3198735e6c529d9bdf38ca3fcb3155515249b98dc4d966b8ddf9d2b"}, - {file = "django_redis-4.11.0-py3-none-any.whl", hash = "sha256:e1aad4cc5bd743d8d0b13d5cae0cef5410eaace33e83bff5fc3a139ad8db50b4"}, + {file = "django-redis-5.4.0.tar.gz", hash = "sha256:6a02abaa34b0fea8bf9b707d2c363ab6adc7409950b2db93602e6cb292818c42"}, + {file = "django_redis-5.4.0-py3-none-any.whl", hash = "sha256:ebc88df7da810732e2af9987f7f426c96204bf89319df4c6da6ca9a2942edd5b"}, ] [package.dependencies] -Django = ">=1.11" -redis = ">=2.10.0" +Django = ">=3.2" +redis = ">=3,<4.0.0 || >4.0.0,<4.0.1 || >4.0.1" + +[package.extras] +hiredis = ["redis[hiredis] (>=3,!=4.0.0,!=4.0.1)"] [[package]] name = "django-referrer-policy" @@ -661,26 +675,27 @@ Django = ">=1.11" [[package]] name = "django-storages" -version = "1.9.1" +version = "1.14.2" description = "Support for many storage backends in Django" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=3.7" files = [ - {file = "django-storages-1.9.1.tar.gz", hash = "sha256:a59e9923cbce7068792f75344ed7727021ee4ac20f227cf17297d0d03d141e91"}, - {file = "django_storages-1.9.1-py2.py3-none-any.whl", hash = "sha256:3103991c2ee8cef8a2ff096709973ffe7106183d211a79f22cf855f33533d924"}, + {file = "django-storages-1.14.2.tar.gz", hash = "sha256:51b36af28cc5813b98d5f3dfe7459af638d84428c8df4a03990c7d74d1bea4e5"}, + {file = "django_storages-1.14.2-py3-none-any.whl", hash = "sha256:1db759346b52ada6c2efd9f23d8241ecf518813eb31db9e2589207174f58f6ad"}, ] [package.dependencies] boto3 = {version = ">=1.4.4", optional = true, markers = "extra == \"boto3\""} -Django = ">=1.11" +Django = ">=3.2" [package.extras] -azure = ["azure-storage-blob (>=1.3.1,<12.0.0)"] +azure = ["azure-core (>=1.13)", "azure-storage-blob (>=12)"] boto3 = ["boto3 (>=1.4.4)"] dropbox = ["dropbox (>=7.2.1)"] -google = ["google-cloud-storage (>=1.15.0)"] +google = ["google-cloud-storage (>=1.27)"] libcloud = ["apache-libcloud"] -sftp = ["paramiko"] +s3 = ["boto3 (>=1.4.4)"] +sftp = ["paramiko (>=1.15)"] [[package]] name = "django-taggit" @@ -930,18 +945,22 @@ dev = ["flake8", "markdown", "twine", "wheel"] [[package]] name = "gunicorn" -version = "19.9.0" +version = "20.1.0" description = "WSGI HTTP Server for UNIX" optional = true -python-versions = ">=2.6, !=3.0.*, !=3.1.*" +python-versions = ">=3.5" files = [ - {file = "gunicorn-19.9.0-py2.py3-none-any.whl", hash = "sha256:aa8e0b40b4157b36a5df5e599f45c9c76d6af43845ba3b3b0efe2c70473c2471"}, - {file = "gunicorn-19.9.0.tar.gz", hash = "sha256:fa2662097c66f920f53f70621c6c58ca4a3c4d3434205e608e121b5b3b71f4f3"}, + {file = "gunicorn-20.1.0-py3-none-any.whl", hash = "sha256:9dcc4547dbb1cb284accfb15ab5667a0e5d1881cc443e0677b4882a4067a807e"}, + {file = "gunicorn-20.1.0.tar.gz", hash = "sha256:e0a968b5ba15f8a328fdfd7ab1fcb5af4470c28aaf7e55df02a99bc13138e6e8"}, ] +[package.dependencies] +setuptools = ">=3.0" + [package.extras] -eventlet = ["eventlet (>=0.9.7)"] -gevent = ["gevent (>=0.13)"] +eventlet = ["eventlet (>=0.24.1)"] +gevent = ["gevent (>=1.4.0)"] +setproctitle = ["setproctitle"] tornado = ["tornado (>=0.2)"] [[package]] @@ -1839,15 +1858,22 @@ pyyaml = "*" [[package]] name = "redis" -version = "2.10.6" -description = "Python client for Redis key-value store" +version = "5.0.1" +description = "Python client for Redis database and key-value store" optional = false -python-versions = "*" +python-versions = ">=3.7" files = [ - {file = "redis-2.10.6-py2.py3-none-any.whl", hash = "sha256:8a1900a9f2a0a44ecf6e8b5eb3e967a9909dfed219ad66df094f27f7d6f330fb"}, - {file = "redis-2.10.6.tar.gz", hash = "sha256:a22ca993cea2962dbb588f9f30d0015ac4afcc45bee27d3978c0dbe9e97c6c0f"}, + {file = "redis-5.0.1-py3-none-any.whl", hash = "sha256:ed4802971884ae19d640775ba3b03aa2e7bd5e8fb8dfaed2decce4d0fc48391f"}, + {file = "redis-5.0.1.tar.gz", hash = "sha256:0dab495cd5753069d3bc650a0dde8a8f9edde16fc5691b689a566eda58100d0f"}, ] +[package.dependencies] +async-timeout = {version = ">=4.0.2", markers = "python_full_version <= \"3.11.2\""} + +[package.extras] +hiredis = ["hiredis (>=1.0.0)"] +ocsp = ["cryptography (>=36.0.1)", "pyopenssl (==20.0.1)", "requests (>=2.26.0)"] + [[package]] name = "requests" version = "2.31.0" @@ -1951,26 +1977,71 @@ contextlib2 = ">=0.5.5" [[package]] name = "scout-apm" -version = "2.0.2" +version = "3.1.0" description = "Scout Application Performance Monitoring Agent" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4" -files = [ - {file = "scout_apm-2.0.2-cp34-cp34m-manylinux1_i686.whl", hash = "sha256:e2ea4861bd9c7ab789e5ad15c38f01c27f3aeb37fd8647908b2ad0bda3cce1e8"}, - {file = "scout_apm-2.0.2-cp34-cp34m-manylinux1_x86_64.whl", hash = "sha256:75fc7949127a7bcdc7473309cf5d732e9bf1843be94bfb268bd29722d9da079d"}, - {file = "scout_apm-2.0.2-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:6be6bf3810afc591a9b4f556dfe81f5bfd2da1538c51df9f7ee6aa609fa43f22"}, - {file = "scout_apm-2.0.2-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:737ac13bc8c11fdb3639fc0b659011480ff0295ebf1866078f3a5c526975ed75"}, - {file = "scout_apm-2.0.2-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:b0e733678ae7d0e00e51c16a26b2e81b54070b9f3589dee0ac0080c466cb0e22"}, - {file = "scout_apm-2.0.2-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:85b19b58de6b0143a21f893babe55b69c741e51ac6e40c87991808a12dd29ef5"}, - {file = "scout_apm-2.0.2-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:c74d0f522f55e64a2c39f03ae1b1746649d5639ec3c7fbb74cf984c4c7ddf40b"}, - {file = "scout_apm-2.0.2-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:4eb2feb9307e9789e645582880546afc6ba5022d5e817768ce95b3c9ff225a74"}, - {file = "scout_apm-2.0.2-py2-none-any.whl", hash = "sha256:caf3bba6c645a46442f858495ae9f0c7df3076b532d5d4c9ef81a2f9ae77c7d9"}, - {file = "scout_apm-2.0.2.tar.gz", hash = "sha256:fef5700b1d7ac413ab8fa7e4f589765d8575a45697676c0f880efacd347f4981"}, -] - -[package.dependencies] -psutil = "*" -requests = "*" +python-versions = ">=3.8, <4" +files = [ + {file = "scout_apm-3.1.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:3f575a031dd7cadac49cdbd7591c91823899bb301a4f3c694f7c98036e1efe2f"}, + {file = "scout_apm-3.1.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d0b1b64377a811e83b93266fb8e5fd65d41b369d930a5c2b5d40429496ccbe9f"}, + {file = "scout_apm-3.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fbf7b66d2c26fcc5dc17b58bb53ed633d61aaabd0b84e8b46b0236cf36b81788"}, + {file = "scout_apm-3.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ebf435b85bef0a8b620bf26197e755679ffecbaa1738ffb4f921f29e04dbfc70"}, + {file = "scout_apm-3.1.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:32f7606780104758b9130c1fc4b6c8b92c232373e62f7818882ca852e65f895d"}, + {file = "scout_apm-3.1.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ffa3de81ba8adaa15cdc7c83c237e3db8a3709b78ff7729358ca673241783633"}, + {file = "scout_apm-3.1.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:238c191fee8298ae3b78393b4af39dfc502699f29b8c6aab40f2f0bc32695e2c"}, + {file = "scout_apm-3.1.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:ceca5a47e0181fda4daea940c90547b9c895547a27a87394cb08dda42efed17c"}, + {file = "scout_apm-3.1.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:dd152b4fa36b4e06cae835819d6bd55d251bb7072b36bf2d11864b89b2d32928"}, + {file = "scout_apm-3.1.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:292adae2dd26d9af75e10e8372895e99b0f2cb20b960e3deefe38384b79070f7"}, + {file = "scout_apm-3.1.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5cb816c12c559d108385adc131f788ed732f1f1b9174485eedfdec9de5111d57"}, + {file = "scout_apm-3.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8c8de0c95931b1e297e0651779a812ca291de99624fb1cffefb095817bb414ce"}, + {file = "scout_apm-3.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d16b3286db1737081204ac428d6168b131e04ef243e4971dc4f4b56c3dcfb082"}, + {file = "scout_apm-3.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:300702331e856856a247065471d26246e9858b5e84be7faf7b67314f36def7e4"}, + {file = "scout_apm-3.1.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:269130d6003d37cbf75ec8bcc585f3e79e14281c92eab4e1c1fec13b9e84090c"}, + {file = "scout_apm-3.1.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:093a1f93f9e12fbc21e8788180513eac2cfc9805a01aa42f69d6231777f134fc"}, + {file = "scout_apm-3.1.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:14e98749de717b1a4e0925c038766b18bce3cd8efc57ba9bccc6da41078a584f"}, + {file = "scout_apm-3.1.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:3b27e11b825b65f9d9119ae03b53a64ad7bc74aae87fa9b145a34f1dddefbfb2"}, + {file = "scout_apm-3.1.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:6c3b169b433025c699455c6409d735169f3ea0ed159bc6153020d37d8cc32f35"}, + {file = "scout_apm-3.1.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:0f02f640d59895b3cd87d02214e05178b766dd15484c36b424a2b8a61766390d"}, + {file = "scout_apm-3.1.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:01963fbc816470fb6df0226104b11ed27dfb79ab78936e38bdaa2535ae4daca4"}, + {file = "scout_apm-3.1.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a6e57348fdd18f75e0a64ac83bdfeab478386883a2d4408eea01f94a96ddf4dd"}, + {file = "scout_apm-3.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ffb7ee21530d0dab9573d07f1cfb12cd00f54817d93ba6805fbfe961df56d553"}, + {file = "scout_apm-3.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:28b36930e175cc4657a76f8606ada26e2f3c7bb54f64dad19cb95f6be4a1fd31"}, + {file = "scout_apm-3.1.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b33c6b6754bfd2a09cbd88f8f99ff1d108707a30ad507dad65a717497f86d89a"}, + {file = "scout_apm-3.1.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6f7f81dc22531bc983c1cb2e1c9466223a9be734db004157a87470779c3a8c7c"}, + {file = "scout_apm-3.1.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f503f3d097408daed4c7a550874635a72d03ad3b914e9009d47f585b73b4e60e"}, + {file = "scout_apm-3.1.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:3c17e463b47b91abf7fac1f61395ee339a0a785d1dbf7dd8965ee7fb9c87e901"}, + {file = "scout_apm-3.1.0-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:382d531e6c2b8f4a4975069471693350dbab5d54f8dc8cc84d55e028a4420c69"}, + {file = "scout_apm-3.1.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:32643c2c85573957b722f428de25a0405b9b29ccf452b3d70cd6dc7fe72a5625"}, + {file = "scout_apm-3.1.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:87d4be53fb769e581f358a3454e94e9511b8cf1ced2afaa316d69cf693ca2440"}, + {file = "scout_apm-3.1.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:294c91615fe4e2157457abb1f9ec4fffbb21523a7ce01d48b507102ef135b7c7"}, + {file = "scout_apm-3.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:74d60cf3d7fc3a09ac2012b1cd2a6eb57eeee2e4c7750fc4136f65f65fe858bb"}, + {file = "scout_apm-3.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:88a3cb411f40cd012fdd668238a1631696ad1d8043bf5a4257457d085a7708b5"}, + {file = "scout_apm-3.1.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7c511f26276882480f637acbad7c6df90c43713741e942281ccb07ada9e0e030"}, + {file = "scout_apm-3.1.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b9f1b992fac5755388c5513c014dcaf48287dac959f77611d0cba7e263ae56a1"}, + {file = "scout_apm-3.1.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:30b5462fea252d1e73b9554df97cb742393b2425ca8a4fe37f3736214989430b"}, + {file = "scout_apm-3.1.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:939d7ee1efa02f94b932fa6b53ad91a50f217222779aec3c9614045d70952143"}, + {file = "scout_apm-3.1.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:b9422f9286458648991394fb2e02cd3d2a9c42a9386f4c006c562a73a354a889"}, + {file = "scout_apm-3.1.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:fb5fce769776a3f073d526ba66183bdce013be2ce55a2ee1faeba18b21391894"}, + {file = "scout_apm-3.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:bf1fd4f0e159511237fb2e6f4b21c62dcac0dcb19787999d4e89570df403594a"}, + {file = "scout_apm-3.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:d5e1fcc2465e038c9670676ab6f4890199d0bb9bc9ec7dc9be756b050b3457c2"}, + {file = "scout_apm-3.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:23372282a8d11fd581be0de2ca53ecdd6c2cc15e43313d297ecb8e3db1f8b70a"}, + {file = "scout_apm-3.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5801a02570069ffe14b4e7d109512795f14a5acff9948e035991c0ff9283c295"}, + {file = "scout_apm-3.1.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fb5157e53f59e8fa25c022ac1a27701dac2fec0410ec412448e56fd9eada7f60"}, + {file = "scout_apm-3.1.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f2daa311d400e614f0207ba70f24375564a8dc5030f417e90304bcb36f5eb2c3"}, + {file = "scout_apm-3.1.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:59c6c0152f9034b6e2e567c2a86a7a9650fda6098b373139c07d76924cd2b835"}, + {file = "scout_apm-3.1.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:0426685073f4ea008c5eba3929e3a454e05b461bace1b1be00e807ec1ce63321"}, + {file = "scout_apm-3.1.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:ab4c6b2785e5b72b83ac6ed01cdd8f4b12335d200dc96f56239e2791b8420b42"}, + {file = "scout_apm-3.1.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:9efdcb2f2512ed81bce6fe20211fdbbc5f1577313cb6f511dc71a7fd66849e02"}, + {file = "scout_apm-3.1.0-py3-none-any.whl", hash = "sha256:d0b488833f8108431964c27b33d38cf60df98b86f7fea09aed93e104179a3649"}, + {file = "scout_apm-3.1.0.tar.gz", hash = "sha256:e57c3ce04ea9c0772ef5b0fc3d0f73e3ee249f5e3a88ef0e7af979e370c4cbed"}, +] + +[package.dependencies] +asgiref = "*" +certifi = "*" +psutil = ">=5,<6" +urllib3 = "*" +wrapt = ">=1.10,<2.0" [[package]] name = "seed-isort-config" @@ -2477,13 +2548,13 @@ watchdog = ["watchdog"] [[package]] name = "whitenoise" -version = "5.0" +version = "6.6.0" description = "Radically simplified static file serving for WSGI applications" optional = false -python-versions = "*" +python-versions = ">=3.8" files = [ - {file = "whitenoise-5.0-py2.py3-none-any.whl", hash = "sha256:7c75090c09f58a261dfece4e12b2c46534ca9d70b3c4b5c2cfca89b59b446498"}, - {file = "whitenoise-5.0.tar.gz", hash = "sha256:1ecfc1d9e16b71a4efc499e1f62a6a06e7728a475d39cb0657ce71e7529f0f08"}, + {file = "whitenoise-6.6.0-py3-none-any.whl", hash = "sha256:b1f9db9bf67dc183484d760b99f4080185633136a273a03f6436034a41064146"}, + {file = "whitenoise-6.6.0.tar.gz", hash = "sha256:8998f7370973447fac1e8ef6e8ded2c5209a7b1f67c1012866dbcd09681c3251"}, ] [package.extras] @@ -2510,6 +2581,85 @@ docs = ["Sphinx (>=7.0)", "sphinx-wagtail-theme (==6.0.0)", "sphinx_copybutton ( heif = ["pillow-heif (>=0.10.0,<1.0.0)"] testing = ["Pillow (>=9.1.0,<11.0.0)", "Wand (>=0.6,<1.0)", "black (==22.3.0)", "coverage[toml] (>=7.2.7,<8.0)", "mock (>=3.0,<4.0)", "pillow-heif (>=0.10.0,<1.0.0)", "ruff (==0.0.275)"] +[[package]] +name = "wrapt" +version = "1.16.0" +description = "Module for decorators, wrappers and monkey patching." +optional = false +python-versions = ">=3.6" +files = [ + {file = "wrapt-1.16.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ffa565331890b90056c01db69c0fe634a776f8019c143a5ae265f9c6bc4bd6d4"}, + {file = "wrapt-1.16.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e4fdb9275308292e880dcbeb12546df7f3e0f96c6b41197e0cf37d2826359020"}, + {file = "wrapt-1.16.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bb2dee3874a500de01c93d5c71415fcaef1d858370d405824783e7a8ef5db440"}, + {file = "wrapt-1.16.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2a88e6010048489cda82b1326889ec075a8c856c2e6a256072b28eaee3ccf487"}, + {file = "wrapt-1.16.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac83a914ebaf589b69f7d0a1277602ff494e21f4c2f743313414378f8f50a4cf"}, + {file = "wrapt-1.16.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:73aa7d98215d39b8455f103de64391cb79dfcad601701a3aa0dddacf74911d72"}, + {file = "wrapt-1.16.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:807cc8543a477ab7422f1120a217054f958a66ef7314f76dd9e77d3f02cdccd0"}, + {file = "wrapt-1.16.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:bf5703fdeb350e36885f2875d853ce13172ae281c56e509f4e6eca049bdfb136"}, + {file = "wrapt-1.16.0-cp310-cp310-win32.whl", hash = "sha256:f6b2d0c6703c988d334f297aa5df18c45e97b0af3679bb75059e0e0bd8b1069d"}, + {file = "wrapt-1.16.0-cp310-cp310-win_amd64.whl", hash = "sha256:decbfa2f618fa8ed81c95ee18a387ff973143c656ef800c9f24fb7e9c16054e2"}, + {file = "wrapt-1.16.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:1a5db485fe2de4403f13fafdc231b0dbae5eca4359232d2efc79025527375b09"}, + {file = "wrapt-1.16.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:75ea7d0ee2a15733684badb16de6794894ed9c55aa5e9903260922f0482e687d"}, + {file = "wrapt-1.16.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a452f9ca3e3267cd4d0fcf2edd0d035b1934ac2bd7e0e57ac91ad6b95c0c6389"}, + {file = "wrapt-1.16.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:43aa59eadec7890d9958748db829df269f0368521ba6dc68cc172d5d03ed8060"}, + {file = "wrapt-1.16.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:72554a23c78a8e7aa02abbd699d129eead8b147a23c56e08d08dfc29cfdddca1"}, + {file = "wrapt-1.16.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:d2efee35b4b0a347e0d99d28e884dfd82797852d62fcd7ebdeee26f3ceb72cf3"}, + {file = "wrapt-1.16.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:6dcfcffe73710be01d90cae08c3e548d90932d37b39ef83969ae135d36ef3956"}, + {file = "wrapt-1.16.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:eb6e651000a19c96f452c85132811d25e9264d836951022d6e81df2fff38337d"}, + {file = "wrapt-1.16.0-cp311-cp311-win32.whl", hash = "sha256:66027d667efe95cc4fa945af59f92c5a02c6f5bb6012bff9e60542c74c75c362"}, + {file = "wrapt-1.16.0-cp311-cp311-win_amd64.whl", hash = "sha256:aefbc4cb0a54f91af643660a0a150ce2c090d3652cf4052a5397fb2de549cd89"}, + {file = "wrapt-1.16.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:5eb404d89131ec9b4f748fa5cfb5346802e5ee8836f57d516576e61f304f3b7b"}, + {file = "wrapt-1.16.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:9090c9e676d5236a6948330e83cb89969f433b1943a558968f659ead07cb3b36"}, + {file = "wrapt-1.16.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:94265b00870aa407bd0cbcfd536f17ecde43b94fb8d228560a1e9d3041462d73"}, + {file = "wrapt-1.16.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f2058f813d4f2b5e3a9eb2eb3faf8f1d99b81c3e51aeda4b168406443e8ba809"}, + {file = "wrapt-1.16.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:98b5e1f498a8ca1858a1cdbffb023bfd954da4e3fa2c0cb5853d40014557248b"}, + {file = "wrapt-1.16.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:14d7dc606219cdd7405133c713f2c218d4252f2a469003f8c46bb92d5d095d81"}, + {file = "wrapt-1.16.0-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:49aac49dc4782cb04f58986e81ea0b4768e4ff197b57324dcbd7699c5dfb40b9"}, + {file = "wrapt-1.16.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:418abb18146475c310d7a6dc71143d6f7adec5b004ac9ce08dc7a34e2babdc5c"}, + {file = "wrapt-1.16.0-cp312-cp312-win32.whl", hash = "sha256:685f568fa5e627e93f3b52fda002c7ed2fa1800b50ce51f6ed1d572d8ab3e7fc"}, + {file = "wrapt-1.16.0-cp312-cp312-win_amd64.whl", hash = "sha256:dcdba5c86e368442528f7060039eda390cc4091bfd1dca41e8046af7c910dda8"}, + {file = "wrapt-1.16.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:d462f28826f4657968ae51d2181a074dfe03c200d6131690b7d65d55b0f360f8"}, + {file = "wrapt-1.16.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a33a747400b94b6d6b8a165e4480264a64a78c8a4c734b62136062e9a248dd39"}, + {file = "wrapt-1.16.0-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b3646eefa23daeba62643a58aac816945cadc0afaf21800a1421eeba5f6cfb9c"}, + {file = "wrapt-1.16.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ebf019be5c09d400cf7b024aa52b1f3aeebeff51550d007e92c3c1c4afc2a40"}, + {file = "wrapt-1.16.0-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:0d2691979e93d06a95a26257adb7bfd0c93818e89b1406f5a28f36e0d8c1e1fc"}, + {file = "wrapt-1.16.0-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:1acd723ee2a8826f3d53910255643e33673e1d11db84ce5880675954183ec47e"}, + {file = "wrapt-1.16.0-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:bc57efac2da352a51cc4658878a68d2b1b67dbe9d33c36cb826ca449d80a8465"}, + {file = "wrapt-1.16.0-cp36-cp36m-win32.whl", hash = "sha256:da4813f751142436b075ed7aa012a8778aa43a99f7b36afe9b742d3ed8bdc95e"}, + {file = "wrapt-1.16.0-cp36-cp36m-win_amd64.whl", hash = "sha256:6f6eac2360f2d543cc875a0e5efd413b6cbd483cb3ad7ebf888884a6e0d2e966"}, + {file = "wrapt-1.16.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a0ea261ce52b5952bf669684a251a66df239ec6d441ccb59ec7afa882265d593"}, + {file = "wrapt-1.16.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7bd2d7ff69a2cac767fbf7a2b206add2e9a210e57947dd7ce03e25d03d2de292"}, + {file = "wrapt-1.16.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9159485323798c8dc530a224bd3ffcf76659319ccc7bbd52e01e73bd0241a0c5"}, + {file = "wrapt-1.16.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a86373cf37cd7764f2201b76496aba58a52e76dedfaa698ef9e9688bfd9e41cf"}, + {file = "wrapt-1.16.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:73870c364c11f03ed072dda68ff7aea6d2a3a5c3fe250d917a429c7432e15228"}, + {file = "wrapt-1.16.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:b935ae30c6e7400022b50f8d359c03ed233d45b725cfdd299462f41ee5ffba6f"}, + {file = "wrapt-1.16.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:db98ad84a55eb09b3c32a96c576476777e87c520a34e2519d3e59c44710c002c"}, + {file = "wrapt-1.16.0-cp37-cp37m-win32.whl", hash = "sha256:9153ed35fc5e4fa3b2fe97bddaa7cbec0ed22412b85bcdaf54aeba92ea37428c"}, + {file = "wrapt-1.16.0-cp37-cp37m-win_amd64.whl", hash = "sha256:66dfbaa7cfa3eb707bbfcd46dab2bc6207b005cbc9caa2199bcbc81d95071a00"}, + {file = "wrapt-1.16.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1dd50a2696ff89f57bd8847647a1c363b687d3d796dc30d4dd4a9d1689a706f0"}, + {file = "wrapt-1.16.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:44a2754372e32ab315734c6c73b24351d06e77ffff6ae27d2ecf14cf3d229202"}, + {file = "wrapt-1.16.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e9723528b9f787dc59168369e42ae1c3b0d3fadb2f1a71de14531d321ee05b0"}, + {file = "wrapt-1.16.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:dbed418ba5c3dce92619656802cc5355cb679e58d0d89b50f116e4a9d5a9603e"}, + {file = "wrapt-1.16.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:941988b89b4fd6b41c3f0bfb20e92bd23746579736b7343283297c4c8cbae68f"}, + {file = "wrapt-1.16.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:6a42cd0cfa8ffc1915aef79cb4284f6383d8a3e9dcca70c445dcfdd639d51267"}, + {file = "wrapt-1.16.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:1ca9b6085e4f866bd584fb135a041bfc32cab916e69f714a7d1d397f8c4891ca"}, + {file = "wrapt-1.16.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:d5e49454f19ef621089e204f862388d29e6e8d8b162efce05208913dde5b9ad6"}, + {file = "wrapt-1.16.0-cp38-cp38-win32.whl", hash = "sha256:c31f72b1b6624c9d863fc095da460802f43a7c6868c5dda140f51da24fd47d7b"}, + {file = "wrapt-1.16.0-cp38-cp38-win_amd64.whl", hash = "sha256:490b0ee15c1a55be9c1bd8609b8cecd60e325f0575fc98f50058eae366e01f41"}, + {file = "wrapt-1.16.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9b201ae332c3637a42f02d1045e1d0cccfdc41f1f2f801dafbaa7e9b4797bfc2"}, + {file = "wrapt-1.16.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:2076fad65c6736184e77d7d4729b63a6d1ae0b70da4868adeec40989858eb3fb"}, + {file = "wrapt-1.16.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c5cd603b575ebceca7da5a3a251e69561bec509e0b46e4993e1cac402b7247b8"}, + {file = "wrapt-1.16.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b47cfad9e9bbbed2339081f4e346c93ecd7ab504299403320bf85f7f85c7d46c"}, + {file = "wrapt-1.16.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f8212564d49c50eb4565e502814f694e240c55551a5f1bc841d4fcaabb0a9b8a"}, + {file = "wrapt-1.16.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:5f15814a33e42b04e3de432e573aa557f9f0f56458745c2074952f564c50e664"}, + {file = "wrapt-1.16.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:db2e408d983b0e61e238cf579c09ef7020560441906ca990fe8412153e3b291f"}, + {file = "wrapt-1.16.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:edfad1d29c73f9b863ebe7082ae9321374ccb10879eeabc84ba3b69f2579d537"}, + {file = "wrapt-1.16.0-cp39-cp39-win32.whl", hash = "sha256:ed867c42c268f876097248e05b6117a65bcd1e63b779e916fe2e33cd6fd0d3c3"}, + {file = "wrapt-1.16.0-cp39-cp39-win_amd64.whl", hash = "sha256:eb1b046be06b0fce7249f1d025cd359b4b80fc1c3e24ad9eca33e0dcdb2e4a35"}, + {file = "wrapt-1.16.0-py3-none-any.whl", hash = "sha256:6906c4100a8fcbf2fa735f6059214bb13b97f75b1a61777fcf6432121ef12ef1"}, + {file = "wrapt-1.16.0.tar.gz", hash = "sha256:5f370f952971e7d17c7d1ead40e49f32345a7f7a5373571ef44d800d06b1899d"}, +] + [[package]] name = "zeep" version = "3.4.0" @@ -2561,4 +2711,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "2f6ac600eb9f46b5da4e47cdd60552271792e9c62730877019804b0047651320" +content-hash = "9953b01a4b7ece0c7880fddda1876743cd52d3430f6b9e99d0728bf05f1a7bd5" diff --git a/pyproject.toml b/pyproject.toml index d6c4dd4f..3e2075f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,21 +10,20 @@ bleach = "3.1.0" dj-database-url = "0.5.0" Django = "~4.2" django-basic-auth-ip-whitelist = "^0.5" -django-birdbath = "^1.0.0" +django-birdbath = "^1.1.1" django-csp = "3.7" django-gov-notify = "^0.4.0" django-pattern-library = "~1.2.0" -django-redis = "4.11.0" +django-redis = "~5.4.0" django-referrer-policy = "1.0" -django-storages = {version = "1.9.1", extras = ["boto3"]} +django-storages = {version = "1.14.2", extras = ["boto3"]} elasticsearch = "7.9.0" factory-boy = "3.2.1" freezegun = "1.1.0" -gunicorn = {version = "19.9.0", optional = true} -psycopg2 = "^2.9.7" +gunicorn = {version = "~20.1", optional = true} +psycopg2 = "~2.9" PyJWT = "2.0.0" -redis = "2.10.6" -scout-apm = "2.0.2" +scout-apm = "~3.1" tabulate = "0.8.7" urllib3 = "1.26.11" wagtail = "~5.2" @@ -33,7 +32,7 @@ wagtail-factories = "^4.1.0" wagtail-orderable = "^1.2.0" wagtail-transfer = "^0.9.3" wagtailgeowidget = "8.1.1" -whitenoise = "5.0" +whitenoise = "~6.6" zeep = "3.4.0" sentry-sdk = "^1.19.1" backoff = "^2.2.1" From e61a558a681f022e9f1cd67bdf46328ec916f791 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 15:45:09 +0800 Subject: [PATCH 24/45] Fix failing test --- bc/cases/tests/test_models.py | 2 +- bc/recruitment/tests/test_views.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bc/cases/tests/test_models.py b/bc/cases/tests/test_models.py index ad715b22..ba854b1c 100644 --- a/bc/cases/tests/test_models.py +++ b/bc/cases/tests/test_models.py @@ -144,7 +144,7 @@ def test_success_page(self, mock_get_form, mock_get_client): session.save() with self.assertTemplateUsed("patterns/pages/cases/form_page_landing.html"): resp = self.client.get(self.case_form_page.url) - self.assertNotIn("form", resp.context) + self.assertFalse(resp.context["case_reference"]) class CaseNameFormattingTest(TestCase): diff --git a/bc/recruitment/tests/test_views.py b/bc/recruitment/tests/test_views.py index 081c5fbf..a3800b10 100644 --- a/bc/recruitment/tests/test_views.py +++ b/bc/recruitment/tests/test_views.py @@ -108,7 +108,7 @@ def test_404_when_job_id_is_badly_formatted(self): + self.homepage.reverse_subpage("apply") + "?jobId=" + str(job_id), - headers={"host": self.site.hostname + ":80"} + headers={"host": self.site.hostname + ":80"}, ) self.assertEqual(resp.status_code, 404) @@ -132,7 +132,7 @@ def test_view_when_job_id_does_not_exist(self): + self.homepage.reverse_subpage("apply") + "?jobId=" + str(job_id), - headers={"host": self.site.hostname + ":80"} + headers={"host": self.site.hostname + ":80"}, ) self.assertEqual(resp.status_code, 200) @@ -170,7 +170,7 @@ def test_sidebar_not_shown_when_job_id_does_not_exist(self): self.homepage.full_url + self.homepage.reverse_subpage("apply") + "?jobId=abc-123", - headers={"host": self.site.hostname + ":80"} + headers={"host": self.site.hostname + ":80"}, ) self.assertEqual(resp.status_code, 200) self.assertEqual(resp.context["show_sidebar"], False) From fb1eba11b6b7857074265d22836a7166ac3e5e65 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 16:03:33 +0800 Subject: [PATCH 25/45] Upgrade Poetry version to 1.7.1 --- .gitlab-ci.yml | 2 +- Dockerfile | 2 +- poetry.lock | 4 ++-- pyproject.toml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b4eecd06..4c4eb07a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,7 +55,7 @@ poetry: image: python:3.8-bullseye stage: build variables: - POETRY_VERSION: 1.5.1 + POETRY_VERSION: 1.7.1 script: - pip install poetry==$POETRY_VERSION - python -m venv venv diff --git a/Dockerfile b/Dockerfile index 1e13e4a9..7d1d6d8b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ ARG POETRY_HOME=/opt/poetry ARG POETRY_INSTALL_ARGS="--no-dev" # IMPORTANT: Remember to review both of these when upgrading -ARG POETRY_VERSION=1.5.1 +ARG POETRY_VERSION=1.7.1 # Install dependencies in a virtualenv ENV VIRTUAL_ENV=/venv diff --git a/poetry.lock b/poetry.lock index 7c174024..6f518e05 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. [[package]] name = "anyascii" @@ -2711,4 +2711,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "9953b01a4b7ece0c7880fddda1876743cd52d3430f6b9e99d0728bf05f1a7bd5" +content-hash = "67ddb912946a8816eb77aab1f0a3ccfc2e6a4186786ef8aa5e090f7db8f38dfe" diff --git a/pyproject.toml b/pyproject.toml index 3e2075f6..46211649 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ wagtail-modeladmin = "^1.0.0" [tool.poetry.extras] gunicorn = ["gunicorn"] -[tool.poetry.dev-dependencies] +[tool.poetry.group.dev.dependencies] # Docs dependencies mkdocs = "1.3.0" mkdocs-material = "8.2.8" From 9f817bce2ef0f26d7996a0ee3868659c5a073cd4 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 16:07:54 +0800 Subject: [PATCH 26/45] Install tblib as part of developer dependency --- poetry.lock | 13 ++++++++++++- pyproject.toml | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index 6f518e05..e51082fd 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2236,6 +2236,17 @@ files = [ [package.extras] widechars = ["wcwidth"] +[[package]] +name = "tblib" +version = "3.0.0" +description = "Traceback serialization library." +optional = false +python-versions = ">=3.8" +files = [ + {file = "tblib-3.0.0-py3-none-any.whl", hash = "sha256:80a6c77e59b55e83911e1e607c649836a69c103963c5f28a46cbeef44acf8129"}, + {file = "tblib-3.0.0.tar.gz", hash = "sha256:93622790a0a29e04f0346458face1e144dc4d32f493714c6c3dff82a4adb77e6"}, +] + [[package]] name = "telepath" version = "0.3.1" @@ -2711,4 +2722,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "67ddb912946a8816eb77aab1f0a3ccfc2e6a4186786ef8aa5e090f7db8f38dfe" +content-hash = "18ff0b2e585a1ef22abbfccb00597f72b724d6994952f60dbe4a1c16f61b1816" diff --git a/pyproject.toml b/pyproject.toml index 46211649..a6bce63c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,6 +69,7 @@ django-extensions = "~3.2" honcho = "^1.1.0" pre-commit = "1.16.1" Werkzeug = "0.14.1" +tblib = "^3.0.0" [build-system] requires = ["poetry-core>=1.0.0"] From 01d1b08fa55252f04773bc767c6b706b570aa8fd Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 16:09:32 +0800 Subject: [PATCH 27/45] Upgrade sentry-sdk to 1.40.5 --- poetry.lock | 11 +++++++---- pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/poetry.lock b/poetry.lock index e51082fd..fd761bac 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2059,13 +2059,13 @@ files = [ [[package]] name = "sentry-sdk" -version = "1.29.2" +version = "1.40.5" description = "Python client for Sentry (https://sentry.io)" optional = false python-versions = "*" files = [ - {file = "sentry-sdk-1.29.2.tar.gz", hash = "sha256:a99ee105384788c3f228726a88baf515fe7b5f1d2d0f215a03d194369f158df7"}, - {file = "sentry_sdk-1.29.2-py2.py3-none-any.whl", hash = "sha256:3e17215d8006612e2df02b0e73115eb8376c37e3f586d8436fa41644e605074d"}, + {file = "sentry-sdk-1.40.5.tar.gz", hash = "sha256:d2dca2392cc5c9a2cc9bb874dd7978ebb759682fe4fe889ee7e970ee8dd1c61e"}, + {file = "sentry_sdk-1.40.5-py2.py3-none-any.whl", hash = "sha256:d188b407c9bacbe2a50a824e1f8fb99ee1aeb309133310488c570cb6d7056643"}, ] [package.dependencies] @@ -2075,10 +2075,12 @@ urllib3 = {version = ">=1.26.11", markers = "python_version >= \"3.6\""} [package.extras] aiohttp = ["aiohttp (>=3.5)"] arq = ["arq (>=0.23)"] +asyncpg = ["asyncpg (>=0.23)"] beam = ["apache-beam (>=2.12)"] bottle = ["bottle (>=0.12.13)"] celery = ["celery (>=3)"] chalice = ["chalice (>=1.16.0)"] +clickhouse-driver = ["clickhouse-driver (>=0.2.0)"] django = ["django (>=1.8)"] falcon = ["falcon (>=1.4)"] fastapi = ["fastapi (>=0.79.0)"] @@ -2088,6 +2090,7 @@ httpx = ["httpx (>=0.16.0)"] huey = ["huey (>=2)"] loguru = ["loguru (>=0.5)"] opentelemetry = ["opentelemetry-distro (>=0.35b0)"] +opentelemetry-experimental = ["opentelemetry-distro (>=0.40b0,<1.0)", "opentelemetry-instrumentation-aiohttp-client (>=0.40b0,<1.0)", "opentelemetry-instrumentation-django (>=0.40b0,<1.0)", "opentelemetry-instrumentation-fastapi (>=0.40b0,<1.0)", "opentelemetry-instrumentation-flask (>=0.40b0,<1.0)", "opentelemetry-instrumentation-requests (>=0.40b0,<1.0)", "opentelemetry-instrumentation-sqlite3 (>=0.40b0,<1.0)", "opentelemetry-instrumentation-urllib (>=0.40b0,<1.0)"] pure-eval = ["asttokens", "executing", "pure-eval"] pymongo = ["pymongo (>=3.1)"] pyspark = ["pyspark (>=2.4.4)"] @@ -2722,4 +2725,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "18ff0b2e585a1ef22abbfccb00597f72b724d6994952f60dbe4a1c16f61b1816" +content-hash = "348a7c667d542461331fb9bb11bf2d522baea4629179f04499f2de2e8145ff11" diff --git a/pyproject.toml b/pyproject.toml index a6bce63c..cca9692d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ wagtail-transfer = "^0.9.3" wagtailgeowidget = "8.1.1" whitenoise = "~6.6" zeep = "3.4.0" -sentry-sdk = "^1.19.1" +sentry-sdk = "^1.40.5" backoff = "^2.2.1" responses = "0.16.0" django-filter = "^23.5" From 8e77a5349f97bf33c157edc8137d7ab31f2a3f3a Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 16:14:54 +0800 Subject: [PATCH 28/45] Update Django settings --- bc/settings/base.py | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/bc/settings/base.py b/bc/settings/base.py index c7677ea2..bca8d6c0 100644 --- a/bc/settings/base.py +++ b/bc/settings/base.py @@ -43,6 +43,15 @@ if "NONINDEXED_HOSTS" in env: NONINDEXED_HOSTS = env["NONINDEXED_HOSTS"].split(",") +# A list of trusted origins for unsafe requests (e.g. POST). +# For requests that include the Origin header, +# Django’s CSRF protection requires that header match +# the origin present in the Host header. +# Important: values must include the scheme (e.g. https://) and the hostname +# https://docs.djangoproject.com/en/stable/ref/settings/#csrf-trusted-origins +if "CSRF_TRUSTED_ORIGINS" in env: + CSRF_TRUSTED_ORIGINS = env["CSRF_TRUSTED_ORIGINS"].split(",") + # Application definition @@ -291,8 +300,13 @@ # The static files with this backend are generated when you run # "django-admin collectstatic". # http://whitenoise.evans.io/en/stable/#quickstart-for-django-apps -# https://docs.djangoproject.com/en/stable/ref/settings/#staticfiles-storage -STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" +# https://docs.djangoproject.com/en/stable/ref/settings/#std-setting-STORAGES +STORAGES = { + "default": {"BACKEND": "django.core.files.storage.FileSystemStorage"}, + "staticfiles": { + "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage" + }, +} # Place static files that need a specific URL (such as robots.txt and favicon.ico) in the "public" folder WHITENOISE_ROOT = os.path.join(BASE_DIR, "public") @@ -353,8 +367,8 @@ # Add django-storages to the installed apps INSTALLED_APPS.append("storages") - # https://docs.djangoproject.com/en/stable/ref/settings/#default-file-storage - DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" + # https://docs.djangoproject.com/en/stable/ref/settings/#std-setting-STORAGES + STORAGES["default"]["BACKEND"] = "storages.backends.s3boto3.S3Boto3Storage" AWS_STORAGE_BUCKET_NAME = env["AWS_STORAGE_BUCKET_NAME"] @@ -613,17 +627,14 @@ SECURE_HSTS_SECONDS = int(env["SECURE_HSTS_SECONDS"]) -# https://docs.djangoproject.com/en/stable/ref/settings/#secure-browser-xss-filter -if env.get("SECURE_BROWSER_XSS_FILTER", "true").lower().strip() == "true": - SECURE_BROWSER_XSS_FILTER = True - - # https://docs.djangoproject.com/en/stable/ref/settings/#secure-content-type-nosniff if env.get("SECURE_CONTENT_TYPE_NOSNIFF", "true").lower().strip() == "true": SECURE_CONTENT_TYPE_NOSNIFF = True # Content Security policy settings +# Most modern browsers don’t honor the X-XSS-Protection HTTP header. +# You can use Content-Security-Policy without allowing 'unsafe-inline' scripts instead. # http://django-csp.readthedocs.io/en/latest/configuration.html if "CSP_DEFAULT_SRC" in env: MIDDLEWARE.append("csp.middleware.CSPMiddleware") @@ -890,3 +901,9 @@ "bc.blogs.birdbath.DeleteAllBlogAlertSubscriptionProcessor", "bc.recruitment.birdbath.DeleteAllRecruitmentAlertSubscriptionProcessor", ] + +# Isolates the browsing context exclusively to same-origin documents. +# Cross-origin documents are not loaded in the same browsing context. +# Set to "same-origin-allow-popups" to allow popups +# from third-party applications like PayPal or Zoom as needed +SECURE_CROSS_ORIGIN_OPENER_POLICY = "same-origin" From e85d68109257a9e802a15cadc03daf009fecca5e Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Fri, 23 Feb 2024 16:18:09 +0800 Subject: [PATCH 29/45] Update infrastructure.md to have notes regarding CSRF_TRUSTED_ORIGINS --- docs/infrastructure.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/infrastructure.md b/docs/infrastructure.md index fef22c9f..d8103940 100644 --- a/docs/infrastructure.md +++ b/docs/infrastructure.md @@ -216,3 +216,41 @@ Set `ENABLE_JOBS_SEARCH_ALERT_SUBSCRIPTIONS=false` in environment variables. Thi ### Feedback widget Set `ENABLE_FEEDBACK_WIDGET=false` in environment variables. This removes the form from the page footer, but does not disable the corresponding views. + +## Cross-Site Request Forgery (CSRF) Protection + +Including values in the `CSRF_TRUSTED_ORIGINS` setting in your Django deployment is crucial for bolstering security, especially in multi-domain environments. By specifying trusted domains from which form submissions are accepted without requiring CSRF tokens, you strike a balance between security and usability. + +This ensures that legitimate requests from trusted domains proceed smoothly while still protecting against CSRF attacks from untrusted sources. In essence, `CSRF_TRUSTED_ORIGINS` helps prevent false positives and enhances the overall security posture of your application by allowing you to explicitly define trusted origins for CSRF protection. + +To set the value on Heroku: + +**Using Heroku CLI** + +1. Open your terminal or command prompt. +2. Log in to your Heroku account using the Heroku CLI: + +```bash +heroku login +``` + +3. Navigate to your Django project directory. +4. Set the `CSRF_TRUSTED_ORIGINS` config variable using the Heroku CLI: + +```bash +heroku config:set CSRF_TRUSTED_ORIGINS=your_trusted_origin_here +``` + +5. Replace `your_trusted_origin_here` with the domain(s) you want to trust for CSRF protection. If you have multiple origins, separate them with commas. + +**Using Heroku Dashboard** + +1. Log in to your Heroku account and navigate to your Heroku Dashboard. +2. Select your Django application from the list of apps. +3. Go to the "Settings" tab. +4. Scroll down to the "Config Vars" section. +5. Click on the "Reveal Config Vars" button if it's not already visible. +6. Add a new config var with the key `CSRF_TRUSTED_ORIGINS` and specify the trusted origin(s) as the value. If you have multiple origins, separate them with commas. +7. Click "Add" or "Save" to save the changes. + +Once you've set the `CSRF_TRUSTED_ORIGINS` config variable on Heroku, your Django application will use the specified trusted origins for CSRF protection. Make sure to restart your Heroku application after making these changes for them to take effect. From 8cb4719b40f7b41cc5a6ddcfc5618e8d487e8a2c Mon Sep 17 00:00:00 2001 From: Rachel Smith Date: Fri, 23 Feb 2024 16:12:24 +0000 Subject: [PATCH 30/45] update AWS settings --- bc/settings/base.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bc/settings/base.py b/bc/settings/base.py index bca8d6c0..da9d679c 100644 --- a/bc/settings/base.py +++ b/bc/settings/base.py @@ -381,6 +381,11 @@ # Not having this setting may have consequences in losing files. AWS_S3_FILE_OVERWRITE = False + # Default ACL for new files should be "private" - not accessible to the + # public. Images should be made available to public via the bucket policy, + # where the documents should use wagtail-storages. + AWS_DEFAULT_ACL = "private" + # We generally use this setting in the production to put the S3 bucket # behind a CDN using a custom domain, e.g. media.llamasavers.com. # https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#cloudfront From d719b8958bfc41d0a17c9283c28d4ccf9fa4f1af Mon Sep 17 00:00:00 2001 From: Rachel Smith Date: Fri, 23 Feb 2024 16:56:30 +0000 Subject: [PATCH 31/45] update boto3 --- poetry.lock | 58 ++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/poetry.lock b/poetry.lock index fd761bac..957c80c6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -213,35 +213,41 @@ webencodings = "*" [[package]] name = "boto3" -version = "1.7.84" +version = "1.34.48" description = "The AWS SDK for Python" optional = false -python-versions = "*" +python-versions = ">= 3.8" files = [ - {file = "boto3-1.7.84-py2.py3-none-any.whl", hash = "sha256:0ed4b107c3b4550547aaec3c9bb17df068ff92d1f6f4781205800e2cb8a66de5"}, - {file = "boto3-1.7.84.tar.gz", hash = "sha256:64496f2c814e454e26c024df86bd08fb4643770d0e2b7a8fd70055fc6683eb9d"}, + {file = "boto3-1.34.48-py3-none-any.whl", hash = "sha256:adc785ff05aec9fc93f82d507420b320203cd4fd011c67eb369b3aa2b5aeb298"}, + {file = "boto3-1.34.48.tar.gz", hash = "sha256:f9873c3f03de546d7297475c6acd771840c385521caadb8c121a1ac38bc59cd4"}, ] [package.dependencies] -botocore = ">=1.10.84,<1.11.0" -jmespath = ">=0.7.1,<1.0.0" -s3transfer = ">=0.1.10,<0.2.0" +botocore = ">=1.34.48,<1.35.0" +jmespath = ">=0.7.1,<2.0.0" +s3transfer = ">=0.10.0,<0.11.0" + +[package.extras] +crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] [[package]] name = "botocore" -version = "1.10.84" +version = "1.34.48" description = "Low-level, data-driven core of boto 3." optional = false -python-versions = "*" +python-versions = ">= 3.8" files = [ - {file = "botocore-1.10.84-py2.py3-none-any.whl", hash = "sha256:380852e1adb9ba4ba9ff096af61f88a6888197b86e580e1bd786f04ebe6f9c0c"}, - {file = "botocore-1.10.84.tar.gz", hash = "sha256:d3e4b5a2c903ea30d19d41ea2f65d0e51dce54f4f4c4dfd6ecd7b04f240844a8"}, + {file = "botocore-1.34.48-py3-none-any.whl", hash = "sha256:f3e1c84fa75fd6921dfbfb4b2f803bcc424b9b866982fe80e08edbd26ca9861c"}, + {file = "botocore-1.34.48.tar.gz", hash = "sha256:eabdde36309274b76bb79ae9bdfa10c1fd91a2c9b3343cfa15b8a91f8e1ec224"}, ] [package.dependencies] -docutils = ">=0.10" -jmespath = ">=0.7.1,<1.0.0" -python-dateutil = {version = ">=2.1,<3.0.0", markers = "python_version >= \"2.7\""} +jmespath = ">=0.7.1,<2.0.0" +python-dateutil = ">=2.1,<3.0.0" +urllib3 = {version = ">=1.25.4,<1.27", markers = "python_version < \"3.10\""} + +[package.extras] +crt = ["awscrt (==0.19.19)"] [[package]] name = "cached-property" @@ -750,17 +756,6 @@ files = [ {file = "docopt-0.6.2.tar.gz", hash = "sha256:49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491"}, ] -[[package]] -name = "docutils" -version = "0.20.1" -description = "Docutils -- Python Documentation Utilities" -optional = false -python-versions = ">=3.7" -files = [ - {file = "docutils-0.20.1-py3-none-any.whl", hash = "sha256:96f387a2c5562db4476f09f13bbab2192e764cac08ebbf3a34a95d9b1e4a59d6"}, - {file = "docutils-0.20.1.tar.gz", hash = "sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b"}, -] - [[package]] name = "draftjs-exporter" version = "2.1.7" @@ -1949,17 +1944,20 @@ jupyter = ["ipywidgets (>=7.5.1,<8.0.0)"] [[package]] name = "s3transfer" -version = "0.1.13" +version = "0.10.0" description = "An Amazon S3 Transfer Manager" optional = false -python-versions = "*" +python-versions = ">= 3.8" files = [ - {file = "s3transfer-0.1.13-py2.py3-none-any.whl", hash = "sha256:c7a9ec356982d5e9ab2d4b46391a7d6a950e2b04c472419f5fdec70cc0ada72f"}, - {file = "s3transfer-0.1.13.tar.gz", hash = "sha256:90dc18e028989c609146e241ea153250be451e05ecc0c2832565231dacdf59c1"}, + {file = "s3transfer-0.10.0-py3-none-any.whl", hash = "sha256:3cdb40f5cfa6966e812209d0994f2a4709b561c88e90cf00c2696d2df4e56b2e"}, + {file = "s3transfer-0.10.0.tar.gz", hash = "sha256:d0c8bbf672d5eebbe4e57945e23b972d963f07d82f661cabf678a5c88831595b"}, ] [package.dependencies] -botocore = ">=1.3.0,<2.0.0" +botocore = ">=1.33.2,<2.0a.0" + +[package.extras] +crt = ["botocore[crt] (>=1.33.2,<2.0a.0)"] [[package]] name = "schema" From e04070c4149e791396a355e59cc8ba36673298df Mon Sep 17 00:00:00 2001 From: Nick Moreton Date: Mon, 18 Mar 2024 14:10:29 +0000 Subject: [PATCH 32/45] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c4230cc..90b35a7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +Wagtail 5.2 and Django 4.2 upgrade + Compare: ## 69.14 (2024-02-05) From 9b02e7984ebf6728e4818cdbfd0b3deb4f98b234 Mon Sep 17 00:00:00 2001 From: Nick Moreton Date: Wed, 1 May 2024 14:41:58 +0100 Subject: [PATCH 33/45] Upgrade wagtail --- poetry.lock | 63 ++++++++++++++++++++++++++++++++------------------ pyproject.toml | 4 ++-- 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/poetry.lock b/poetry.lock index 25d24a03..00b2ea47 100644 --- a/poetry.lock +++ b/poetry.lock @@ -705,17 +705,17 @@ sftp = ["paramiko (>=1.15)"] [[package]] name = "django-taggit" -version = "3.1.0" +version = "5.0.1" description = "django-taggit is a reusable Django application for simple tagging." optional = false -python-versions = ">=3.6" +python-versions = ">=3.8" files = [ - {file = "django-taggit-3.1.0.tar.gz", hash = "sha256:c8f2e4eae387939089b3d75d1d8649e008880970c068ce9d0e82f87fd5e29508"}, - {file = "django_taggit-3.1.0-py3-none-any.whl", hash = "sha256:543218ac346fbe02a65733e0341c91b57a3e0f7a41568966b26f1cea9edc4805"}, + {file = "django-taggit-5.0.1.tar.gz", hash = "sha256:edcd7db1e0f35c304e082a2f631ddac2e16ef5296029524eb792af7430cab4cc"}, + {file = "django_taggit-5.0.1-py3-none-any.whl", hash = "sha256:a0ca8a28b03c4b26c2630fd762cb76ec39b5e41abf727a7b66f897a625c5e647"}, ] [package.dependencies] -Django = ">=3.2" +Django = ">=4.1" [[package]] name = "django-treebeard" @@ -1116,6 +1116,24 @@ files = [ pytz = ">=2020.1" six = "*" +[[package]] +name = "laces" +version = "0.1.1" +description = "Django components that know how to render themselves." +optional = false +python-versions = ">=3.8" +files = [ + {file = "laces-0.1.1-py3-none-any.whl", hash = "sha256:ae2c575b9aaa46154e5518c61c9f86f5a9478f753a51e9c5547c7d275d361242"}, + {file = "laces-0.1.1.tar.gz", hash = "sha256:e45159c46f6adca33010d34e9af869e57201b70675c6dc088e919b16c89456a4"}, +] + +[package.dependencies] +Django = ">=3.2" + +[package.extras] +dev = ["black (==24.1.1)", "blacken-docs (==1.16.0)", "coverage (==7.3.4)", "django-stubs[compatible-mypy] (==4.2.7)", "flake8 (==7.0.0)", "flake8-bugbear", "flake8-comprehensions", "isort (==5.13.2)", "mypy (==1.7.1)", "pre-commit (==3.4.0)", "tox (==4.12.1)", "tox-gh-actions (==3.2.0)", "types-requests (==2.31.0.20240125)", "virtualenv-pyenv (==0.4.0)"] +testing = ["coverage (==7.3.4)", "dj-database-url (==2.1.0)"] + [[package]] name = "lxml" version = "4.9.3" @@ -2342,37 +2360,38 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess [[package]] name = "wagtail" -version = "5.2.3" +version = "6.0.3" description = "A Django content management system." optional = false python-versions = ">=3.8" files = [ - {file = "wagtail-5.2.3-py3-none-any.whl", hash = "sha256:7b186b37ba044fd68c1a3c584ac0d913daa4ea95b95aa4c80412e4a0cb04e563"}, - {file = "wagtail-5.2.3.tar.gz", hash = "sha256:ad64595124c84c4b00b73b863029a7722e06b4dba17b76177d2f4944f579bca7"}, + {file = "wagtail-6.0.3-py3-none-any.whl", hash = "sha256:673337cdb1f96ebe5cb063472cff96a28cab488dc4ccf1de5b38901c289803ff"}, + {file = "wagtail-6.0.3.tar.gz", hash = "sha256:bfcea95b7de879197fa2bc26810fe5fae78e616056ad8d09b3f66b1604c456a9"}, ] [package.dependencies] anyascii = ">=0.1.5" -beautifulsoup4 = ">=4.8,<4.12" -Django = ">=3.2,<5.1" +beautifulsoup4 = ">=4.8,<4.13" +Django = ">=4.2,<6.0" django-filter = ">=23.3,<24" -django-modelcluster = ">=6.1,<7.0" +django-modelcluster = ">=6.2.1,<7.0" django-permissionedforms = ">=0.1,<1.0" -django-taggit = ">=2.0,<5.0" +django-taggit = ">=4.0,<5.1" django-treebeard = ">=4.5.1,<5.0" djangorestframework = ">=3.11.1,<4.0" -draftjs-exporter = ">=2.1.5,<3.0" +draftjs-exporter = ">=2.1.5,<6.0" html5lib = ">=0.999,<2" l18n = ">=2018.5" +laces = ">=0.1,<0.2" openpyxl = ">=3.0.10,<4.0" Pillow = ">=9.1.0,<11.0.0" requests = ">=2.11.1,<3.0" telepath = ">=0.3.1,<1" -Willow = {version = ">=1.6.2,<1.7", extras = ["heif"]} +Willow = {version = ">=1.6.2,<2", extras = ["heif"]} [package.extras] -docs = ["Sphinx (>=1.5.2)", "myst-parser (==0.18.1)", "pyenchant (>=3.1.1,<4)", "sphinx-autobuild (>=0.6.0)", "sphinx-copybutton (>=0.5,<1.0)", "sphinx-wagtail-theme (==6.1.1)", "sphinxcontrib-spelling (>=5.4.0,<6)"] -testing = ["Jinja2 (>=3.0,<3.2)", "azure-mgmt-cdn (>=12.0,<13.0)", "azure-mgmt-frontdoor (>=1.0,<1.1)", "black (==22.3.0)", "boto3 (>=1.28,<2)", "coverage (>=3.7.0)", "curlylint (==0.13.1)", "django-pattern-library (>=0.7,<0.8)", "djhtml (==1.5.2)", "doc8 (==0.8.1)", "factory-boy (>=3.2)", "freezegun (>=0.3.8)", "polib (>=1.1,<2.0)", "python-dateutil (>=2.7)", "pytz (>=2014.7)", "ruff (==0.0.290)", "semgrep (==1.40.0)", "tblib (>=2.0,<3.0)"] +docs = ["Sphinx (>=1.5.2)", "myst-parser (==2.0.0)", "pyenchant (>=3.1.1,<4)", "sphinx-autobuild (>=0.6.0)", "sphinx-copybutton (>=0.5,<1.0)", "sphinx-wagtail-theme (==6.3.0)", "sphinxcontrib-spelling (>=7,<8)"] +testing = ["Jinja2 (>=3.0,<3.2)", "azure-mgmt-cdn (>=12.0,<13.0)", "azure-mgmt-frontdoor (>=1.0,<1.1)", "boto3 (>=1.28,<2)", "coverage (>=3.7.0)", "curlylint (==0.13.1)", "django-pattern-library (>=0.7)", "djhtml (==3.0.6)", "doc8 (==0.8.1)", "factory-boy (>=3.2)", "freezegun (>=0.3.8)", "polib (>=1.1,<2.0)", "python-dateutil (>=2.7)", "pytz (>=2014.7)", "ruff (==0.1.5)", "semgrep (==1.40.0)", "tblib (>=2.0,<3.0)"] [[package]] name = "wagtail-django-recaptcha" @@ -2416,20 +2435,20 @@ test = ["coverage (==6.0)", "flake8 (==4.0.0)", "flake8-blind-except (==0.1.1)", [[package]] name = "wagtail-modeladmin" -version = "1.0.0" +version = "2.0.0" description = "Add any model in your project to the Wagtail admin. Formerly wagtail.contrib.modeladmin." optional = false python-versions = ">=3.8" files = [ - {file = "wagtail_modeladmin-1.0.0-py3-none-any.whl", hash = "sha256:0d92dd012e17dd5b5d5058792c8549594884c87da7ef794e8f1765bb245a5340"}, - {file = "wagtail_modeladmin-1.0.0.tar.gz", hash = "sha256:da545ba34747bff01c942b8306e20ac17d8a64d1873734cc8cf7303716af93fc"}, + {file = "wagtail_modeladmin-2.0.0-py3-none-any.whl", hash = "sha256:36931ce4b2c2bb56d0367317b29786eb001344b7c9a1cd4f719d7f11efeae71b"}, + {file = "wagtail_modeladmin-2.0.0.tar.gz", hash = "sha256:3794c854b86d69ad1b2ec4f3ee5e6852ff8cb0505bd9151186ef26e0a88d84bc"}, ] [package.dependencies] -Wagtail = ">=5.0" +Wagtail = ">=5.2" [package.extras] -docs = ["Sphinx (>=6.0)", "myst_parser (>=0.18.1,<1.0)", "pyenchant (>=3.1.1,<4)", "sphinx-autobuild (>=0.6.0)", "sphinx-wagtail-theme (==6.0.0)", "sphinx_copybutton (>=0.5)", "sphinxcontrib-spelling (>=8.0,<9.0)"] +docs = ["Sphinx (>=6.0)", "myst_parser (>=0.18.1,<1.0)", "pyenchant (>=3.1.1,<4)", "sphinx-autobuild (>=0.6.0)", "sphinx-wagtail-theme (==6.2.0)", "sphinx_copybutton (>=0.5)", "sphinxcontrib-spelling (>=8.0,<9.0)"] testing = ["dj-database-url (>=2.0.0)", "pre-commit (<3.0)"] [[package]] @@ -2711,4 +2730,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "b2093623976e14f59700dd079b4d0b905ad8d4592154e137925ef50e2bba14b6" +content-hash = "3f18dcf346598507b88619ac9977b559355e4cbd6af9bb827120e064405d6e8a" diff --git a/pyproject.toml b/pyproject.toml index 352ef07b..def41a50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ PyJWT = "2.0.0" scout-apm = "~3.1" tabulate = "0.8.7" urllib3 = "1.26.11" -wagtail = "~5.2" +wagtail = "~6.0" wagtail-django-recaptcha = {git = "https://github.com/torchbox-forks/wagtail-django-recaptcha", tag = "2.1.1+tbx"} wagtail-factories = "^4.1.0" wagtail-orderable = "^1.2.0" @@ -38,7 +38,7 @@ sentry-sdk = "^1.40.5" backoff = "^2.2.1" responses = "0.16.0" django-filter = "^23.5" -wagtail-modeladmin = "^1.0.0" +wagtail-modeladmin = "^2.0.0" [tool.poetry.extras] gunicorn = ["gunicorn"] From 5d3242c9c35263cb676a5364e52e2a9e1fbe3374 Mon Sep 17 00:00:00 2001 From: Nick Moreton Date: Wed, 1 May 2024 14:57:24 +0100 Subject: [PATCH 34/45] Update poetry --- .gitlab-ci.yml | 2 +- .secrets.baseline | 4 ++-- Dockerfile | 2 +- poetry.lock | 26 ++++++++++++++------------ 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4c4eb07a..de07e117 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,7 +55,7 @@ poetry: image: python:3.8-bullseye stage: build variables: - POETRY_VERSION: 1.7.1 + POETRY_VERSION: 1.8.2 script: - pip install poetry==$POETRY_VERSION - python -m venv venv diff --git a/.secrets.baseline b/.secrets.baseline index 4a387bfd..097d23ce 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": null, "lines": null }, - "generated_at": "2023-01-31T09:59:38Z", + "generated_at": "2024-05-01T13:57:21Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -50,7 +50,7 @@ { "hashed_secret": "7f6ed39d1d3ed4e0f4880ad4500cb47a0fd025ed", "is_verified": false, - "line_number": 143, + "line_number": 144, "type": "Secret Keyword" } ], diff --git a/Dockerfile b/Dockerfile index 7d1d6d8b..30aa52ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ ARG POETRY_HOME=/opt/poetry ARG POETRY_INSTALL_ARGS="--no-dev" # IMPORTANT: Remember to review both of these when upgrading -ARG POETRY_VERSION=1.7.1 +ARG POETRY_VERSION=1.8.2 # Install dependencies in a virtualenv ENV VIRTUAL_ENV=/venv diff --git a/poetry.lock b/poetry.lock index 00b2ea47..2d6ec8a4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "anyascii" @@ -733,18 +733,18 @@ Django = ">=3.2" [[package]] name = "djangorestframework" -version = "3.14.0" +version = "3.15.1" description = "Web APIs for Django, made easy." optional = false python-versions = ">=3.6" files = [ - {file = "djangorestframework-3.14.0-py3-none-any.whl", hash = "sha256:eb63f58c9f218e1a7d064d17a70751f528ed4e1d35547fdade9aaf4cd103fd08"}, - {file = "djangorestframework-3.14.0.tar.gz", hash = "sha256:579a333e6256b09489cbe0a067e66abe55c6595d8926be6b99423786334350c8"}, + {file = "djangorestframework-3.15.1-py3-none-any.whl", hash = "sha256:3ccc0475bce968608cf30d07fb17d8e52d1d7fc8bfe779c905463200750cbca6"}, + {file = "djangorestframework-3.15.1.tar.gz", hash = "sha256:f88fad74183dfc7144b2756d0d2ac716ea5b4c7c9840995ac3bfd8ec034333c1"}, ] [package.dependencies] +"backports.zoneinfo" = {version = "*", markers = "python_version < \"3.9\""} django = ">=3.0" -pytz = "*" [[package]] name = "docopt" @@ -2581,24 +2581,26 @@ brotli = ["Brotli"] [[package]] name = "willow" -version = "1.6.2" +version = "1.8.0" description = "A Python image library that sits on top of Pillow, Wand and OpenCV" optional = false python-versions = ">=3.8" files = [ - {file = "willow-1.6.2-py3-none-any.whl", hash = "sha256:957a4af8a7733e116a65eca34da11afe3fd52ffdb397494c8823901c25863787"}, - {file = "willow-1.6.2.tar.gz", hash = "sha256:e2d0450fd78ab19052d0478b888ef163e3264e8dcd1af002dd691458db98056f"}, + {file = "willow-1.8.0-py3-none-any.whl", hash = "sha256:48ccf5ce48ccd29c37a32497cd7af50983f8570543c4de2988b15d583efc66be"}, + {file = "willow-1.8.0.tar.gz", hash = "sha256:ef3df6cde80d4914e719188147bef1d71c240edb118340e0c5957ecc8fe08315"}, ] [package.dependencies] defusedxml = ">=0.7,<1.0" filetype = ">=1.0.10,<1.1.0 || >1.1.0" -pillow-heif = {version = ">=0.10.0,<1.0.0", optional = true, markers = "extra == \"heif\""} +pillow-heif = {version = ">=0.10.0,<1.0.0", optional = true, markers = "extra == \"heif\" and python_version < \"3.12\""} [package.extras] -docs = ["Sphinx (>=7.0)", "sphinx-wagtail-theme (==6.0.0)", "sphinx_copybutton (>=0.5)", "sphinxcontrib-spelling (>=8.0,<9.0)"] -heif = ["pillow-heif (>=0.10.0,<1.0.0)"] -testing = ["Pillow (>=9.1.0,<11.0.0)", "Wand (>=0.6,<1.0)", "black (==22.3.0)", "coverage[toml] (>=7.2.7,<8.0)", "mock (>=3.0,<4.0)", "pillow-heif (>=0.10.0,<1.0.0)", "ruff (==0.0.275)"] +docs = ["Sphinx (>=7.0)", "sphinx-wagtail-theme (>=6.1.1,<7.0)", "sphinx_copybutton (>=0.5)", "sphinxcontrib-spelling (>=8.0,<9.0)"] +heif = ["pillow-heif (>=0.10.0,<1.0.0)", "pillow-heif (>=0.13.0,<1.0.0)"] +pillow = ["Pillow (>=9.1.0,<11.0.0)"] +testing = ["coverage[toml] (>=7.2.7,<8.0)", "pre-commit (>=3.4.0)", "willow[heif,pillow,wand]"] +wand = ["Wand (>=0.6,<1.0)"] [[package]] name = "wrapt" From 18ec08d56455c1ea91371e61a27fe7df96b0a285 Mon Sep 17 00:00:00 2001 From: Nick Moreton Date: Wed, 1 May 2024 15:28:45 +0100 Subject: [PATCH 35/45] Fix pre-commit and poetry dependencies --- .pre-commit-config.yaml | 8 +-- poetry.lock | 109 +++++++++++++++++++--------------------- pyproject.toml | 6 +-- 3 files changed, 60 insertions(+), 63 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c0b75aaf..b78313e0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,16 +1,16 @@ repos: - - repo: https://github.com/pre-commit/mirrors-isort - rev: v4.3.15 + - repo: https://github.com/PyCQA/isort + rev: 5.13.2 hooks: - id: isort language_version: python3 - repo: https://github.com/pycqa/flake8 - rev: 3.8.4 + rev: 5.0.4 hooks: - id: flake8 language_version: python3 - repo: https://github.com/python/black - rev: 22.3.0 + rev: 24.4.2 hooks: - id: black language_version: python3 diff --git a/poetry.lock b/poetry.lock index 2d6ec8a4..215b1096 100644 --- a/poetry.lock +++ b/poetry.lock @@ -152,47 +152,47 @@ lxml = ["lxml"] [[package]] name = "black" -version = "22.3.0" +version = "24.4.2" description = "The uncompromising code formatter." optional = false -python-versions = ">=3.6.2" -files = [ - {file = "black-22.3.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:2497f9c2386572e28921fa8bec7be3e51de6801f7459dffd6e62492531c47e09"}, - {file = "black-22.3.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5795a0375eb87bfe902e80e0c8cfaedf8af4d49694d69161e5bd3206c18618bb"}, - {file = "black-22.3.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e3556168e2e5c49629f7b0f377070240bd5511e45e25a4497bb0073d9dda776a"}, - {file = "black-22.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:67c8301ec94e3bcc8906740fe071391bce40a862b7be0b86fb5382beefecd968"}, - {file = "black-22.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:fd57160949179ec517d32ac2ac898b5f20d68ed1a9c977346efbac9c2f1e779d"}, - {file = "black-22.3.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:cc1e1de68c8e5444e8f94c3670bb48a2beef0e91dddfd4fcc29595ebd90bb9ce"}, - {file = "black-22.3.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d2fc92002d44746d3e7db7cf9313cf4452f43e9ea77a2c939defce3b10b5c82"}, - {file = "black-22.3.0-cp36-cp36m-win_amd64.whl", hash = "sha256:a6342964b43a99dbc72f72812bf88cad8f0217ae9acb47c0d4f141a6416d2d7b"}, - {file = "black-22.3.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:328efc0cc70ccb23429d6be184a15ce613f676bdfc85e5fe8ea2a9354b4e9015"}, - {file = "black-22.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:06f9d8846f2340dfac80ceb20200ea5d1b3f181dd0556b47af4e8e0b24fa0a6b"}, - {file = "black-22.3.0-cp37-cp37m-win_amd64.whl", hash = "sha256:ad4efa5fad66b903b4a5f96d91461d90b9507a812b3c5de657d544215bb7877a"}, - {file = "black-22.3.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e8477ec6bbfe0312c128e74644ac8a02ca06bcdb8982d4ee06f209be28cdf163"}, - {file = "black-22.3.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:637a4014c63fbf42a692d22b55d8ad6968a946b4a6ebc385c5505d9625b6a464"}, - {file = "black-22.3.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:863714200ada56cbc366dc9ae5291ceb936573155f8bf8e9de92aef51f3ad0f0"}, - {file = "black-22.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10dbe6e6d2988049b4655b2b739f98785a884d4d6b85bc35133a8fb9a2233176"}, - {file = "black-22.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:cee3e11161dde1b2a33a904b850b0899e0424cc331b7295f2a9698e79f9a69a0"}, - {file = "black-22.3.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:5891ef8abc06576985de8fa88e95ab70641de6c1fca97e2a15820a9b69e51b20"}, - {file = "black-22.3.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:30d78ba6bf080eeaf0b7b875d924b15cd46fec5fd044ddfbad38c8ea9171043a"}, - {file = "black-22.3.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ee8f1f7228cce7dffc2b464f07ce769f478968bfb3dd1254a4c2eeed84928aad"}, - {file = "black-22.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6ee227b696ca60dd1c507be80a6bc849a5a6ab57ac7352aad1ffec9e8b805f21"}, - {file = "black-22.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:9b542ced1ec0ceeff5b37d69838106a6348e60db7b8fdd245294dc1d26136265"}, - {file = "black-22.3.0-py3-none-any.whl", hash = "sha256:bc58025940a896d7e5356952228b68f793cf5fcb342be703c3a2669a1488cb72"}, - {file = "black-22.3.0.tar.gz", hash = "sha256:35020b8886c022ced9282b51b5a875b6d1ab0c387b31a065b84db7c33085ca79"}, +python-versions = ">=3.8" +files = [ + {file = "black-24.4.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:dd1b5a14e417189db4c7b64a6540f31730713d173f0b63e55fabd52d61d8fdce"}, + {file = "black-24.4.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8e537d281831ad0e71007dcdcbe50a71470b978c453fa41ce77186bbe0ed6021"}, + {file = "black-24.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eaea3008c281f1038edb473c1aa8ed8143a5535ff18f978a318f10302b254063"}, + {file = "black-24.4.2-cp310-cp310-win_amd64.whl", hash = "sha256:7768a0dbf16a39aa5e9a3ded568bb545c8c2727396d063bbaf847df05b08cd96"}, + {file = "black-24.4.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:257d724c2c9b1660f353b36c802ccece186a30accc7742c176d29c146df6e474"}, + {file = "black-24.4.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:bdde6f877a18f24844e381d45e9947a49e97933573ac9d4345399be37621e26c"}, + {file = "black-24.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e151054aa00bad1f4e1f04919542885f89f5f7d086b8a59e5000e6c616896ffb"}, + {file = "black-24.4.2-cp311-cp311-win_amd64.whl", hash = "sha256:7e122b1c4fb252fd85df3ca93578732b4749d9be076593076ef4d07a0233c3e1"}, + {file = "black-24.4.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:accf49e151c8ed2c0cdc528691838afd217c50412534e876a19270fea1e28e2d"}, + {file = "black-24.4.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:88c57dc656038f1ab9f92b3eb5335ee9b021412feaa46330d5eba4e51fe49b04"}, + {file = "black-24.4.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:be8bef99eb46d5021bf053114442914baeb3649a89dc5f3a555c88737e5e98fc"}, + {file = "black-24.4.2-cp312-cp312-win_amd64.whl", hash = "sha256:415e686e87dbbe6f4cd5ef0fbf764af7b89f9057b97c908742b6008cc554b9c0"}, + {file = "black-24.4.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bf10f7310db693bb62692609b397e8d67257c55f949abde4c67f9cc574492cc7"}, + {file = "black-24.4.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:98e123f1d5cfd42f886624d84464f7756f60ff6eab89ae845210631714f6db94"}, + {file = "black-24.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:48a85f2cb5e6799a9ef05347b476cce6c182d6c71ee36925a6c194d074336ef8"}, + {file = "black-24.4.2-cp38-cp38-win_amd64.whl", hash = "sha256:b1530ae42e9d6d5b670a34db49a94115a64596bc77710b1d05e9801e62ca0a7c"}, + {file = "black-24.4.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:37aae07b029fa0174d39daf02748b379399b909652a806e5708199bd93899da1"}, + {file = "black-24.4.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:da33a1a5e49c4122ccdfd56cd021ff1ebc4a1ec4e2d01594fef9b6f267a9e741"}, + {file = "black-24.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ef703f83fc32e131e9bcc0a5094cfe85599e7109f896fe8bc96cc402f3eb4b6e"}, + {file = "black-24.4.2-cp39-cp39-win_amd64.whl", hash = "sha256:b9176b9832e84308818a99a561e90aa479e73c523b3f77afd07913380ae2eab7"}, + {file = "black-24.4.2-py3-none-any.whl", hash = "sha256:d36ed1124bb81b32f8614555b34cc4259c3fbc7eec17870e8ff8ded335b58d8c"}, + {file = "black-24.4.2.tar.gz", hash = "sha256:c872b53057f000085da66a19c55d68f6f8ddcac2642392ad3a355878406fbd4d"}, ] [package.dependencies] click = ">=8.0.0" mypy-extensions = ">=0.4.3" +packaging = ">=22.0" pathspec = ">=0.9.0" platformdirs = ">=2" tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} -typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""} +typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} [package.extras] colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)"] +d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] @@ -881,19 +881,19 @@ files = [ [[package]] name = "flake8" -version = "3.8.4" +version = "5.0.4" description = "the modular source code checker: pep8 pyflakes and co" optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" +python-versions = ">=3.6.1" files = [ - {file = "flake8-3.8.4-py2.py3-none-any.whl", hash = "sha256:749dbbd6bfd0cf1318af27bf97a14e28e5ff548ef8e5b1566ccfb25a11e7c839"}, - {file = "flake8-3.8.4.tar.gz", hash = "sha256:aadae8761ec651813c24be05c6f7b4680857ef6afaae4651a4eccaef97ce6c3b"}, + {file = "flake8-5.0.4-py2.py3-none-any.whl", hash = "sha256:7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248"}, + {file = "flake8-5.0.4.tar.gz", hash = "sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db"}, ] [package.dependencies] -mccabe = ">=0.6.0,<0.7.0" -pycodestyle = ">=2.6.0a1,<2.7.0" -pyflakes = ">=2.2.0,<2.3.0" +mccabe = ">=0.7.0,<0.8.0" +pycodestyle = ">=2.9.0,<2.10.0" +pyflakes = ">=2.5.0,<2.6.0" [[package]] name = "freezegun" @@ -1058,20 +1058,17 @@ six = "*" [[package]] name = "isort" -version = "4.3.18" +version = "5.13.2" description = "A Python utility / library to sort Python imports." optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=3.8.0" files = [ - {file = "isort-4.3.18-py2.py3-none-any.whl", hash = "sha256:1349c6f7c2a0f7539f5f2ace51a9a8e4a37086ce4de6f78f5f53fb041d0a3cd5"}, - {file = "isort-4.3.18.tar.gz", hash = "sha256:f09911f6eb114e5592abe635aded8bf3d2c3144ebcfcaf81ee32e7af7b7d1870"}, + {file = "isort-5.13.2-py3-none-any.whl", hash = "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6"}, + {file = "isort-5.13.2.tar.gz", hash = "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109"}, ] [package.extras] -pipfile = ["pipreqs", "requirementslib"] -pyproject = ["toml"] -requirements = ["pip-api", "pipreqs"] -xdg-home = ["appdirs (>=1.4.0)"] +colors = ["colorama (>=0.4.6)"] [[package]] name = "jinja2" @@ -1330,13 +1327,13 @@ files = [ [[package]] name = "mccabe" -version = "0.6.1" +version = "0.7.0" description = "McCabe checker, plugin for flake8" optional = false -python-versions = "*" +python-versions = ">=3.6" files = [ - {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, - {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, + {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, + {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, ] [[package]] @@ -1715,24 +1712,24 @@ files = [ [[package]] name = "pycodestyle" -version = "2.6.0" +version = "2.9.1" description = "Python style guide checker" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=3.6" files = [ - {file = "pycodestyle-2.6.0-py2.py3-none-any.whl", hash = "sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367"}, - {file = "pycodestyle-2.6.0.tar.gz", hash = "sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"}, + {file = "pycodestyle-2.9.1-py2.py3-none-any.whl", hash = "sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b"}, + {file = "pycodestyle-2.9.1.tar.gz", hash = "sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785"}, ] [[package]] name = "pyflakes" -version = "2.2.0" +version = "2.5.0" description = "passive checker of Python programs" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=3.6" files = [ - {file = "pyflakes-2.2.0-py2.py3-none-any.whl", hash = "sha256:0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92"}, - {file = "pyflakes-2.2.0.tar.gz", hash = "sha256:35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"}, + {file = "pyflakes-2.5.0-py2.py3-none-any.whl", hash = "sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2"}, + {file = "pyflakes-2.5.0.tar.gz", hash = "sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3"}, ] [[package]] @@ -2732,4 +2729,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "3f18dcf346598507b88619ac9977b559355e4cbd6af9bb827120e064405d6e8a" +content-hash = "1d02eb923074e3811e7b82cc01c78a2984fee0099c8e43b79ba2a1c8ccd926e7" diff --git a/pyproject.toml b/pyproject.toml index def41a50..840d82ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,10 +50,10 @@ mkdocs-material = "8.2.8" pymdown-extensions = "9.3" # Linting -black = "22.3.0" +black = "24.4.2" detect-secrets = "0.13.0" -flake8 = "3.8.4" -isort = "4.3.18" +flake8 = "~5.0" +isort = "5.13.2" seed-isort-config = "1.9.0" # Database snapshots From b3abd147998788618f810ff227db519106780b4d Mon Sep 17 00:00:00 2001 From: Nick Moreton Date: Wed, 1 May 2024 15:08:18 +0100 Subject: [PATCH 36/45] Remove use_json_field from StreamField instances --- bc/blogs/models.py | 8 +++----- bc/campaigns/models.py | 4 +--- bc/cases/models.py | 13 +++++-------- bc/events/models.py | 3 +-- bc/inlineindex/models.py | 5 ++--- bc/location/models.py | 6 +----- bc/longform/models.py | 5 ++--- bc/navigation/models.py | 3 --- bc/news/models.py | 3 +-- bc/people/models.py | 3 +-- bc/recruitment/models.py | 13 +++++-------- bc/standardpages/models.py | 5 ++--- bc/step_by_step/models.py | 3 +-- bc/utils/models.py | 1 - 14 files changed, 25 insertions(+), 50 deletions(-) diff --git a/bc/blogs/models.py b/bc/blogs/models.py index ac9882ba..0890c9ee 100644 --- a/bc/blogs/models.py +++ b/bc/blogs/models.py @@ -9,7 +9,7 @@ from django.template.loader import render_to_string from django.utils.functional import cached_property from django.views.generic import TemplateView - +from django_gov_notify.message import NotifyEmailMessage from modelcluster.fields import ParentalKey, ParentalManyToManyField from wagtail import models as wt_models from wagtail.admin.panels import ( @@ -21,8 +21,6 @@ from wagtail.contrib.routable_page.models import RoutablePageMixin, route from wagtail.fields import StreamField -from django_gov_notify.message import NotifyEmailMessage - from bc.blogs.forms import BlogHomePageForm, BlogPostPageForm from bc.utils.blocks import StoryBlock from bc.utils.constants import ALERT_SUBSCRIPTION_STATUSES @@ -335,7 +333,7 @@ class BlogAboutPage(BasePage): blank=True, ) - body = StreamField(StoryBlock(), use_json_field=True) + body = StreamField(StoryBlock()) content_panels = BasePage.content_panels + [ FieldPanel("intro_text"), @@ -372,7 +370,7 @@ class BlogPostPage(BasePage): author = models.TextField() date_published = models.DateField() - body = StreamField(StoryBlock(), use_json_field=True) + body = StreamField(StoryBlock()) content_panels = BasePage.content_panels + [ FieldPanel("categories", widget=CheckboxSelectMultiple), diff --git a/bc/campaigns/models.py b/bc/campaigns/models.py index cdba6292..0df536ff 100644 --- a/bc/campaigns/models.py +++ b/bc/campaigns/models.py @@ -1,6 +1,5 @@ from django.db import models from django.shortcuts import redirect - from wagtail import fields from wagtail import models as wt_models from wagtail.admin.panels import FieldPanel @@ -33,8 +32,7 @@ class CampaignPage(BasePage): on_delete=models.SET_NULL, ) body = fields.StreamField( - CampaignPageStoryBlock(block_counts={"heading": {"min_num": 3, "max_num": 3}}), - use_json_field=True, + CampaignPageStoryBlock(block_counts={"heading": {"min_num": 3, "max_num": 3}}) ) content_panels = BasePage.content_panels + [ diff --git a/bc/cases/models.py b/bc/cases/models.py index dbf18ddc..e98301e8 100644 --- a/bc/cases/models.py +++ b/bc/cases/models.py @@ -1,15 +1,13 @@ +from bs4 import BeautifulSoup from django.db import models from django.shortcuts import redirect, render from django.utils.functional import cached_property - from modelcluster.fields import ParentalKey from wagtail.admin.panels import FieldPanel, InlinePanel, MultiFieldPanel from wagtail.contrib.routable_page.models import RoutablePageMixin, route from wagtail.fields import RichTextField, StreamField from wagtail.search import index -from bs4 import BeautifulSoup - from bc.cases.backends.respond.client import RespondClientException, get_client from bc.cases.backends.respond.constants import ( APTEAN_FORM_CHOICES, @@ -70,8 +68,7 @@ class ApteanRespondCaseFormPage(RoutablePageMixin, BasePage): form = models.CharField(max_length=255, choices=APTEAN_FORM_CHOICES) body = StreamField( - CaseFormStoryBlock(block_counts={"form_link_button": {"min_num": 1}}), - use_json_field=True, + CaseFormStoryBlock(block_counts={"form_link_button": {"min_num": 1}}) ) introduction = RichTextField( @@ -172,9 +169,9 @@ def form_route(self, request, *args, **kwargs): form, case_reference = self.process_form_submission(form) if form.is_valid(): # still # store the case_reference in the session for the thank you page - request.session[ - self.get_case_reference_session_key() - ] = case_reference + request.session[self.get_case_reference_session_key()] = ( + case_reference + ) request.session[self.get_landing_page_session_key()] = True return redirect(self.url, permanent=False) else: diff --git a/bc/events/models.py b/bc/events/models.py index 40a3ba62..0bd86e25 100644 --- a/bc/events/models.py +++ b/bc/events/models.py @@ -9,7 +9,6 @@ from django.utils.functional import cached_property from django.utils.http import urlencode from django.utils.translation import gettext_lazy as _ - from modelcluster.fields import ParentalKey from wagtail.admin.panels import FieldPanel, FieldRowPanel, InlinePanel, MultiFieldPanel from wagtail.fields import StreamField @@ -65,7 +64,7 @@ class EventPage(BasePage): country = models.CharField(_("Country"), blank=True, max_length=255) introduction = models.TextField(blank=True) - body = StreamField(StoryBlock(), use_json_field=True) + body = StreamField(StoryBlock()) search_fields = BasePage.search_fields + [ index.SearchField("introduction"), diff --git a/bc/inlineindex/models.py b/bc/inlineindex/models.py index 52e4bd2d..95ffabd4 100644 --- a/bc/inlineindex/models.py +++ b/bc/inlineindex/models.py @@ -2,7 +2,6 @@ from django.db import models from django.utils.functional import cached_property - from modelcluster.fields import ParentalKey from wagtail.admin.panels import FieldPanel, InlinePanel from wagtail.fields import StreamField @@ -90,7 +89,7 @@ class InlineIndex(InlineIndexMixin, BasePage): ) intro_text = models.TextField(blank=True) - body = StreamField(StoryBlock(), use_json_field=True) + body = StreamField(StoryBlock()) is_inline_index = True is_inline_index_child = False @@ -158,7 +157,7 @@ def content_title(self): class InlineIndexChild(InlineIndexMixin, BasePage): template = InlineIndex.template - body = StreamField(StoryBlock(), use_json_field=True) + body = StreamField(StoryBlock()) is_inline_index = False is_inline_index_child = True diff --git a/bc/location/models.py b/bc/location/models.py index d05df97f..fe54a1a0 100644 --- a/bc/location/models.py +++ b/bc/location/models.py @@ -1,12 +1,10 @@ from django.db import models from django.db.models.expressions import Case, When from django.utils.functional import cached_property - from modelcluster.fields import ParentalKey from wagtail.admin.panels import FieldPanel, FieldRowPanel, InlinePanel, MultiFieldPanel from wagtail.fields import RichTextField, StreamField from wagtail.rich_text import expand_db_html - from wagtailgeowidget.helpers import geosgeometry_str_to_struct from wagtailgeowidget.panels import GeoAddressPanel, GoogleMapsPanel @@ -20,7 +18,7 @@ class LocationIndexPage(BasePage): subpage_types = ["location.LocationPage"] body = RichTextField(editor="with_h2") - additional_info = StreamField(StoryBlock(), use_json_field=True, blank=True) + additional_info = StreamField(StoryBlock(), blank=True) content_panels = BasePage.content_panels + [ FieldPanel("body"), @@ -65,7 +63,6 @@ class LocationPage(BasePage): additional_info = StreamField( StoryBlock(), - use_json_field=True, blank=True, help_text=( "Additional information about this location like opening times, facilities, etc. " @@ -96,7 +93,6 @@ class LocationPage(BasePage): body = StreamField( StoryBlock(), - use_json_field=True, help_text="Generic body content. This will appear after the map in the template.", ) diff --git a/bc/longform/models.py b/bc/longform/models.py index a1cecc5f..4977a9f0 100644 --- a/bc/longform/models.py +++ b/bc/longform/models.py @@ -1,7 +1,6 @@ from django.conf import settings from django.db import models from django.utils.functional import cached_property - from wagtail.admin.panels import FieldPanel, MultiFieldPanel from wagtail.fields import StreamField from wagtail.search import index @@ -43,7 +42,7 @@ class Meta: max_length=255, ) intro_text = models.TextField(blank=True) - body = StreamField(LongformStoryBlock(), use_json_field=True) + body = StreamField(LongformStoryBlock()) document = models.ForeignKey( settings.WAGTAILDOCS_DOCUMENT_MODEL, @@ -105,7 +104,7 @@ class LongformChapterPage(BasePage): class Meta: verbose_name = "Long-form content chapter page" - body = StreamField(LongformStoryBlock(), use_json_field=True) + body = StreamField(LongformStoryBlock()) search_fields = BasePage.search_fields + [index.SearchField("body")] diff --git a/bc/navigation/models.py b/bc/navigation/models.py index 03a3cd34..63f71f61 100644 --- a/bc/navigation/models.py +++ b/bc/navigation/models.py @@ -1,5 +1,4 @@ from django.db import models - from modelcluster.models import ClusterableModel from wagtail import blocks from wagtail.admin.panels import FieldPanel @@ -41,13 +40,11 @@ class NavigationSettings(BaseSiteSetting, ClusterableModel): max_num=3, ), blank=True, - use_json_field=True, ) footer_links = StreamField( [("link", LinkBlock())], blank=True, help_text="Single list of elements at the base of the page.", - use_json_field=True, ) panels = [ diff --git a/bc/news/models.py b/bc/news/models.py index 846c04c3..9e253fb1 100644 --- a/bc/news/models.py +++ b/bc/news/models.py @@ -3,7 +3,6 @@ from django.db import models from django.db.models.functions import Coalesce from django.utils.functional import cached_property - from modelcluster.fields import ParentalKey from wagtail.admin.panels import FieldPanel, InlinePanel from wagtail.fields import StreamField @@ -50,7 +49,7 @@ class NewsPage(BasePage): "news item appears to have been published.", ) introduction = models.TextField(blank=True) - body = StreamField(StoryBlock(), use_json_field=True) + body = StreamField(StoryBlock()) search_fields = BasePage.search_fields + [ index.SearchField("introduction"), diff --git a/bc/people/models.py b/bc/people/models.py index 09aa32cf..8d04d24b 100644 --- a/bc/people/models.py +++ b/bc/people/models.py @@ -2,7 +2,6 @@ from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator from django.db import models from django.utils.functional import cached_property - from modelcluster.fields import ParentalKey from wagtail.admin.panels import FieldPanel, InlinePanel, MultiFieldPanel from wagtail.fields import StreamField @@ -74,7 +73,7 @@ class PersonPage(BasePage): job_title = models.CharField(max_length=255) introduction = models.TextField(blank=True) website = models.URLField(blank=True, max_length=255) - biography = StreamField(StoryBlock(), blank=True, use_json_field=True) + biography = StreamField(StoryBlock(), blank=True) email = models.EmailField(blank=True) content_panels = BasePage.content_panels + [ diff --git a/bc/recruitment/models.py b/bc/recruitment/models.py index b987b4b1..895ae5f1 100644 --- a/bc/recruitment/models.py +++ b/bc/recruitment/models.py @@ -17,7 +17,7 @@ from django.utils.functional import cached_property from django.utils.safestring import mark_safe from django.utils.text import slugify - +from django_gov_notify.message import NotifyEmailMessage from wagtail import blocks from wagtail.admin.panels import FieldPanel, MultiFieldPanel from wagtail.contrib.routable_page.models import RoutablePageMixin, route @@ -25,8 +25,6 @@ from wagtail.models import Page from wagtail.search import index from wagtail.snippets.models import register_snippet - -from django_gov_notify.message import NotifyEmailMessage from wagtailorderable.models import Orderable from bc.utils.choices import IconChoice @@ -352,7 +350,7 @@ def callback_talentlinkjob_delete_attachments_and_logo( @register_snippet class AwardsSnippet(models.Model): heading = models.CharField(max_length=255) - awards = StreamField([("award", AwardBlock())], use_json_field=True) + awards = StreamField([("award", AwardBlock())]) panels = [ FieldPanel("heading"), @@ -368,8 +366,8 @@ class JobPlatformsMediaSnippet(models.Model): title = models.CharField(max_length=255) description = models.CharField(max_length=255) cta = models.CharField(max_length=255, verbose_name="Call to action text") - job_platforms = StreamField([("platform", JobPlatformBlock())], use_json_field=True) - media_embed = StreamField(MediaBlock(), max_num=1, use_json_field=True) + job_platforms = StreamField([("platform", JobPlatformBlock())]) + media_embed = StreamField(MediaBlock(), max_num=1) def __str__(self): return self.title @@ -439,7 +437,6 @@ class RecruitmentHomePage(RoutablePageMixin, BasePage): required=False, ), blank=True, - use_json_field=True, ) related_recruitment_index_page = models.ForeignKey( "recruitment.RecruitmentIndexPage", @@ -587,7 +584,7 @@ class RecruitmentIndexPage(BasePage): max_length=255, blank=True, ) - body = StreamField(StoryBlock(required=False), blank=True, use_json_field=True) + body = StreamField(StoryBlock(required=False), blank=True) content_panels = BasePage.content_panels + [ MultiFieldPanel( diff --git a/bc/standardpages/models.py b/bc/standardpages/models.py index ef4da0e2..79f8fca4 100644 --- a/bc/standardpages/models.py +++ b/bc/standardpages/models.py @@ -4,7 +4,6 @@ from django.db import models from django.shortcuts import redirect from django.utils.functional import cached_property - from modelcluster.fields import ParentalKey from wagtail.admin.panels import FieldPanel, InlinePanel from wagtail.fields import StreamField @@ -63,7 +62,7 @@ class Meta: class InformationPage(BaseInformationPage): template = "patterns/pages/standardpages/information_page.html" - body = StreamField(StoryBlock(), use_json_field=True) + body = StreamField(StoryBlock()) class StoryBlockWithWasteWizard(StoryBlock): @@ -77,7 +76,7 @@ class WasteWizardPage(BaseInformationPage): template = "patterns/pages/standardpages/information_page.html" is_waste_wizard_page = True - body = StreamField(StoryBlockWithWasteWizard(), use_json_field=True) + body = StreamField(StoryBlockWithWasteWizard()) content_panels = BasePage.content_panels + [ FieldPanel("display_contents"), diff --git a/bc/step_by_step/models.py b/bc/step_by_step/models.py index b51c6ea7..9065d618 100644 --- a/bc/step_by_step/models.py +++ b/bc/step_by_step/models.py @@ -1,5 +1,4 @@ from django.db import models - from wagtail.admin.panels import FieldPanel from wagtail.blocks import StructBlock, TextBlock from wagtail.blocks.field_block import RichTextBlock @@ -22,7 +21,7 @@ class StepByStepPage(BasePage): intro_text = models.TextField(blank=True) introduction = RichTextField(editor="with_h2") - steps = StreamField([("step", StepBlock())], use_json_field=True) + steps = StreamField([("step", StepBlock())]) content_panels = BasePage.content_panels + [ FieldPanel("intro_text"), diff --git a/bc/utils/models.py b/bc/utils/models.py index b0dc1380..0d2647ce 100644 --- a/bc/utils/models.py +++ b/bc/utils/models.py @@ -206,7 +206,6 @@ class CallToActionSnippet(models.Model): required=True, ), blank=True, - use_json_field=True, ) panels = [ From 10aedc5f6cbd178bc6128d292b2ad23cb830fe16 Mon Sep 17 00:00:00 2001 From: Nick Moreton Date: Wed, 1 May 2024 15:38:19 +0100 Subject: [PATCH 37/45] Remove the use of the deprecated SlugInput widget --- bc/utils/models.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bc/utils/models.py b/bc/utils/models.py index 0d2647ce..0f5eff38 100644 --- a/bc/utils/models.py +++ b/bc/utils/models.py @@ -3,10 +3,8 @@ from django.http import HttpResponseRedirect from django.utils.decorators import method_decorator from django.utils.functional import cached_property - from wagtail import blocks from wagtail.admin.panels import FieldPanel, MultiFieldPanel -from wagtail.admin.widgets.slug import SlugInput from wagtail.contrib.settings.models import BaseSiteSetting, register_setting from wagtail.fields import RichTextField, StreamField from wagtail.models import Orderable, Page @@ -345,7 +343,7 @@ class Meta: [ MultiFieldPanel( [ - FieldPanel("slug", widget=SlugInput), + FieldPanel("slug"), FieldPanel("seo_title"), FieldPanel("show_in_menus"), FieldPanel("search_description"), From 04c3afda68f2c6eee3394c8224d7693831ce2146 Mon Sep 17 00:00:00 2001 From: Nick Moreton Date: Wed, 1 May 2024 15:50:40 +0100 Subject: [PATCH 38/45] Run black and isort --- bc/settings/base.py | 4 ++-- bc/utils/blocks.py | 11 ++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/bc/settings/base.py b/bc/settings/base.py index da9d679c..0e0bfdea 100644 --- a/bc/settings/base.py +++ b/bc/settings/base.py @@ -1,12 +1,12 @@ """ Django settings for bc project. """ + import os import sys -from wagtail.embeds.oembed_providers import youtube - import dj_database_url +from wagtail.embeds.oembed_providers import youtube env = os.environ.copy() diff --git a/bc/utils/blocks.py b/bc/utils/blocks.py index c5099caf..a7856df5 100644 --- a/bc/utils/blocks.py +++ b/bc/utils/blocks.py @@ -5,7 +5,6 @@ from django.forms.utils import ErrorList from django.utils.functional import cached_property from django.utils.safestring import mark_safe - from wagtail import blocks from wagtail.admin.staticfiles import versioned_static from wagtail.contrib.table_block.blocks import TableBlock as BaseTableBlock @@ -551,12 +550,10 @@ def __init__(self, local_blocks=None, **kwargs): # Bump down template for heading fields so headings don't clash with those outside the accordion self.child_blocks["heading"] = copy.deepcopy(self.child_blocks["heading"]) self.child_blocks["subheading"] = copy.deepcopy(self.child_blocks["subheading"]) - self.child_blocks[ - "heading" - ].meta.template = "patterns/molecules/streamfield/blocks/subheading_block.html" - self.child_blocks[ - "subheading" - ].meta.template = ( + self.child_blocks["heading"].meta.template = ( + "patterns/molecules/streamfield/blocks/subheading_block.html" + ) + self.child_blocks["subheading"].meta.template = ( "patterns/molecules/streamfield/blocks/subsubheading_block.html" ) From c82244c100729f7c185a49940a8d62303182dc02 Mon Sep 17 00:00:00 2001 From: Nick Moreton Date: Wed, 1 May 2024 16:26:57 +0100 Subject: [PATCH 39/45] Update lint and format config plus add django-upgrade --- .isort.cfg | 6 ------ .pre-commit-config.yaml | 5 +++++ bc/blogs/models.py | 4 +++- bc/campaigns/models.py | 1 + bc/cases/models.py | 4 +++- bc/events/models.py | 1 + bc/inlineindex/models.py | 1 + bc/location/models.py | 2 ++ bc/longform/models.py | 1 + bc/navigation/models.py | 1 + bc/news/models.py | 1 + bc/people/models.py | 1 + bc/recruitment/models.py | 4 +++- bc/search/apps.py | 2 +- bc/settings/base.py | 3 ++- bc/standardpages/models.py | 1 + bc/step_by_step/models.py | 1 + bc/utils/blocks.py | 1 + bc/utils/models.py | 1 + poetry.lock | 33 +++++++++++++++++++++++++++++---- pyproject.toml | 1 + setup.cfg | 5 +++++ 22 files changed, 65 insertions(+), 15 deletions(-) delete mode 100644 .isort.cfg diff --git a/.isort.cfg b/.isort.cfg deleted file mode 100644 index 0ac773da..00000000 --- a/.isort.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[settings] -multi_line_output=3 -include_trailing_comma=True -force_grid_wrap=0 -use_parentheses=True -line_length=88 \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b78313e0..6a3d6b09 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -53,3 +53,8 @@ repos: package-lock.json| poetry.lock )$ + - repo: https://github.com/adamchainz/django-upgrade + rev: '1.16.0' # replace with latest tag on GitHub + hooks: + - id: django-upgrade + args: [--target-version, '4.2'] # Replace with Django version diff --git a/bc/blogs/models.py b/bc/blogs/models.py index 0890c9ee..4ad13e36 100644 --- a/bc/blogs/models.py +++ b/bc/blogs/models.py @@ -9,7 +9,7 @@ from django.template.loader import render_to_string from django.utils.functional import cached_property from django.views.generic import TemplateView -from django_gov_notify.message import NotifyEmailMessage + from modelcluster.fields import ParentalKey, ParentalManyToManyField from wagtail import models as wt_models from wagtail.admin.panels import ( @@ -21,6 +21,8 @@ from wagtail.contrib.routable_page.models import RoutablePageMixin, route from wagtail.fields import StreamField +from django_gov_notify.message import NotifyEmailMessage + from bc.blogs.forms import BlogHomePageForm, BlogPostPageForm from bc.utils.blocks import StoryBlock from bc.utils.constants import ALERT_SUBSCRIPTION_STATUSES diff --git a/bc/campaigns/models.py b/bc/campaigns/models.py index 0df536ff..d91be2ba 100644 --- a/bc/campaigns/models.py +++ b/bc/campaigns/models.py @@ -1,5 +1,6 @@ from django.db import models from django.shortcuts import redirect + from wagtail import fields from wagtail import models as wt_models from wagtail.admin.panels import FieldPanel diff --git a/bc/cases/models.py b/bc/cases/models.py index e98301e8..8135be60 100644 --- a/bc/cases/models.py +++ b/bc/cases/models.py @@ -1,13 +1,15 @@ -from bs4 import BeautifulSoup from django.db import models from django.shortcuts import redirect, render from django.utils.functional import cached_property + from modelcluster.fields import ParentalKey from wagtail.admin.panels import FieldPanel, InlinePanel, MultiFieldPanel from wagtail.contrib.routable_page.models import RoutablePageMixin, route from wagtail.fields import RichTextField, StreamField from wagtail.search import index +from bs4 import BeautifulSoup + from bc.cases.backends.respond.client import RespondClientException, get_client from bc.cases.backends.respond.constants import ( APTEAN_FORM_CHOICES, diff --git a/bc/events/models.py b/bc/events/models.py index 0bd86e25..2125b6d7 100644 --- a/bc/events/models.py +++ b/bc/events/models.py @@ -9,6 +9,7 @@ from django.utils.functional import cached_property from django.utils.http import urlencode from django.utils.translation import gettext_lazy as _ + from modelcluster.fields import ParentalKey from wagtail.admin.panels import FieldPanel, FieldRowPanel, InlinePanel, MultiFieldPanel from wagtail.fields import StreamField diff --git a/bc/inlineindex/models.py b/bc/inlineindex/models.py index 95ffabd4..c97ff071 100644 --- a/bc/inlineindex/models.py +++ b/bc/inlineindex/models.py @@ -2,6 +2,7 @@ from django.db import models from django.utils.functional import cached_property + from modelcluster.fields import ParentalKey from wagtail.admin.panels import FieldPanel, InlinePanel from wagtail.fields import StreamField diff --git a/bc/location/models.py b/bc/location/models.py index fe54a1a0..79fa9636 100644 --- a/bc/location/models.py +++ b/bc/location/models.py @@ -1,10 +1,12 @@ from django.db import models from django.db.models.expressions import Case, When from django.utils.functional import cached_property + from modelcluster.fields import ParentalKey from wagtail.admin.panels import FieldPanel, FieldRowPanel, InlinePanel, MultiFieldPanel from wagtail.fields import RichTextField, StreamField from wagtail.rich_text import expand_db_html + from wagtailgeowidget.helpers import geosgeometry_str_to_struct from wagtailgeowidget.panels import GeoAddressPanel, GoogleMapsPanel diff --git a/bc/longform/models.py b/bc/longform/models.py index 4977a9f0..eef39ef0 100644 --- a/bc/longform/models.py +++ b/bc/longform/models.py @@ -1,6 +1,7 @@ from django.conf import settings from django.db import models from django.utils.functional import cached_property + from wagtail.admin.panels import FieldPanel, MultiFieldPanel from wagtail.fields import StreamField from wagtail.search import index diff --git a/bc/navigation/models.py b/bc/navigation/models.py index 63f71f61..4b8ce86c 100644 --- a/bc/navigation/models.py +++ b/bc/navigation/models.py @@ -1,4 +1,5 @@ from django.db import models + from modelcluster.models import ClusterableModel from wagtail import blocks from wagtail.admin.panels import FieldPanel diff --git a/bc/news/models.py b/bc/news/models.py index 9e253fb1..4a59809b 100644 --- a/bc/news/models.py +++ b/bc/news/models.py @@ -3,6 +3,7 @@ from django.db import models from django.db.models.functions import Coalesce from django.utils.functional import cached_property + from modelcluster.fields import ParentalKey from wagtail.admin.panels import FieldPanel, InlinePanel from wagtail.fields import StreamField diff --git a/bc/people/models.py b/bc/people/models.py index 8d04d24b..ade12789 100644 --- a/bc/people/models.py +++ b/bc/people/models.py @@ -2,6 +2,7 @@ from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator from django.db import models from django.utils.functional import cached_property + from modelcluster.fields import ParentalKey from wagtail.admin.panels import FieldPanel, InlinePanel, MultiFieldPanel from wagtail.fields import StreamField diff --git a/bc/recruitment/models.py b/bc/recruitment/models.py index 895ae5f1..558c027a 100644 --- a/bc/recruitment/models.py +++ b/bc/recruitment/models.py @@ -17,7 +17,7 @@ from django.utils.functional import cached_property from django.utils.safestring import mark_safe from django.utils.text import slugify -from django_gov_notify.message import NotifyEmailMessage + from wagtail import blocks from wagtail.admin.panels import FieldPanel, MultiFieldPanel from wagtail.contrib.routable_page.models import RoutablePageMixin, route @@ -25,6 +25,8 @@ from wagtail.models import Page from wagtail.search import index from wagtail.snippets.models import register_snippet + +from django_gov_notify.message import NotifyEmailMessage from wagtailorderable.models import Orderable from bc.utils.choices import IconChoice diff --git a/bc/search/apps.py b/bc/search/apps.py index 9dbaf27d..20134d13 100644 --- a/bc/search/apps.py +++ b/bc/search/apps.py @@ -5,5 +5,5 @@ class SearchConfig(AppConfig): name = "bc.search" def ready(self): - import bc.search.signal_handlers # noqa import bc.search.query # noqa + import bc.search.signal_handlers # noqa diff --git a/bc/settings/base.py b/bc/settings/base.py index 0e0bfdea..417ff9b7 100644 --- a/bc/settings/base.py +++ b/bc/settings/base.py @@ -5,9 +5,10 @@ import os import sys -import dj_database_url from wagtail.embeds.oembed_providers import youtube +import dj_database_url + env = os.environ.copy() # Build paths inside the project like this: os.path.join(BASE_DIR, ...) diff --git a/bc/standardpages/models.py b/bc/standardpages/models.py index 79f8fca4..db9f209b 100644 --- a/bc/standardpages/models.py +++ b/bc/standardpages/models.py @@ -4,6 +4,7 @@ from django.db import models from django.shortcuts import redirect from django.utils.functional import cached_property + from modelcluster.fields import ParentalKey from wagtail.admin.panels import FieldPanel, InlinePanel from wagtail.fields import StreamField diff --git a/bc/step_by_step/models.py b/bc/step_by_step/models.py index 9065d618..967ccbd7 100644 --- a/bc/step_by_step/models.py +++ b/bc/step_by_step/models.py @@ -1,4 +1,5 @@ from django.db import models + from wagtail.admin.panels import FieldPanel from wagtail.blocks import StructBlock, TextBlock from wagtail.blocks.field_block import RichTextBlock diff --git a/bc/utils/blocks.py b/bc/utils/blocks.py index a7856df5..90d63f30 100644 --- a/bc/utils/blocks.py +++ b/bc/utils/blocks.py @@ -5,6 +5,7 @@ from django.forms.utils import ErrorList from django.utils.functional import cached_property from django.utils.safestring import mark_safe + from wagtail import blocks from wagtail.admin.staticfiles import versioned_static from wagtail.contrib.table_block.blocks import TableBlock as BaseTableBlock diff --git a/bc/utils/models.py b/bc/utils/models.py index 0f5eff38..a7212a5f 100644 --- a/bc/utils/models.py +++ b/bc/utils/models.py @@ -3,6 +3,7 @@ from django.http import HttpResponseRedirect from django.utils.decorators import method_decorator from django.utils.functional import cached_property + from wagtail import blocks from wagtail.admin.panels import FieldPanel, MultiFieldPanel from wagtail.contrib.settings.models import BaseSiteSetting, register_setting diff --git a/poetry.lock b/poetry.lock index 215b1096..25b3bd86 100644 --- a/poetry.lock +++ b/poetry.lock @@ -469,13 +469,13 @@ files = [ [[package]] name = "django" -version = "4.2.10" +version = "4.2.11" description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design." optional = false python-versions = ">=3.8" files = [ - {file = "Django-4.2.10-py3-none-any.whl", hash = "sha256:a2d4c4d4ea0b6f0895acde632071aff6400bfc331228fc978b05452a0ff3e9f1"}, - {file = "Django-4.2.10.tar.gz", hash = "sha256:b1260ed381b10a11753c73444408e19869f3241fc45c985cd55a30177c789d13"}, + {file = "Django-4.2.11-py3-none-any.whl", hash = "sha256:ddc24a0a8280a0430baa37aff11f28574720af05888c62b7cfe71d219f4599d3"}, + {file = "Django-4.2.11.tar.gz", hash = "sha256:6e6ff3db2d8dd0c986b4eec8554c8e4f919b5c1ff62a5b4390c17aff2ed6e5c4"}, ] [package.dependencies] @@ -731,6 +731,20 @@ files = [ [package.dependencies] Django = ">=3.2" +[[package]] +name = "django-upgrade" +version = "1.16.0" +description = "Automatically upgrade your Django project code." +optional = false +python-versions = ">=3.8" +files = [ + {file = "django-upgrade-1.16.0.tar.gz", hash = "sha256:7e473e8ecf234a531448d4a0c1c772746fa831fc762eae3d7578f13f6d847370"}, + {file = "django_upgrade-1.16.0-py3-none-any.whl", hash = "sha256:605708b130368ee6dd304df00253f184a7c2f00d1c2dd5d4dac41a31307a2a14"}, +] + +[package.dependencies] +tokenize-rt = ">=4.1" + [[package]] name = "djangorestframework" version = "3.15.1" @@ -2275,6 +2289,17 @@ files = [ {file = "timeago-1.0.16-py3-none-any.whl", hash = "sha256:9b8cb2e3102b329f35a04aa4531982d867b093b19481cfbb1dac7845fa2f79b0"}, ] +[[package]] +name = "tokenize-rt" +version = "5.2.0" +description = "A wrapper around the stdlib `tokenize` which roundtrips." +optional = false +python-versions = ">=3.8" +files = [ + {file = "tokenize_rt-5.2.0-py2.py3-none-any.whl", hash = "sha256:b79d41a65cfec71285433511b50271b05da3584a1da144a0752e9c621a285289"}, + {file = "tokenize_rt-5.2.0.tar.gz", hash = "sha256:9fe80f8a5c1edad2d3ede0f37481cc0cc1538a2f442c9c2f9e4feacd2792d054"}, +] + [[package]] name = "toml" version = "0.10.2" @@ -2729,4 +2754,4 @@ gunicorn = ["gunicorn"] [metadata] lock-version = "2.0" python-versions = "~3.8" -content-hash = "1d02eb923074e3811e7b82cc01c78a2984fee0099c8e43b79ba2a1c8ccd926e7" +content-hash = "716ba57dc9bc8a538b288a5ce64a59a81096ae059fab99a4636eebe60451d29d" diff --git a/pyproject.toml b/pyproject.toml index 840d82ff..c794aec5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,6 +70,7 @@ honcho = "^1.1.0" pre-commit = "1.16.1" Werkzeug = "0.14.1" tblib = "^3.0.0" +django-upgrade = "^1.16.0" [build-system] requires = ["poetry-core>=1.0.0"] diff --git a/setup.cfg b/setup.cfg index b82e8ec8..ef71e260 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,3 +10,8 @@ known_wagtail=wagtail,modelcluster skip=migrations,node_modules,venv sections=STDLIB,DJANGO,WAGTAIL,THIRDPARTY,FIRSTPARTY,LOCALFOLDER default_section=THIRDPARTY +multi_line_output=3 +include_trailing_comma=True +force_grid_wrap=0 +use_parentheses=True +line_length=88 From c45e165e796a10f51cd04fe7792ddf7bd2cc6980 Mon Sep 17 00:00:00 2001 From: Nick Moreton Date: Thu, 2 May 2024 14:10:54 +0100 Subject: [PATCH 40/45] Update icon usage in wagtail_hooks.py and icon.html --- bc/feedback/wagtail_hooks.py | 4 ++-- .../templates/patterns/atoms/icons/icon.html | 2 +- bc/utils/wagtail_hooks.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bc/feedback/wagtail_hooks.py b/bc/feedback/wagtail_hooks.py index d5d67156..93e3c34b 100644 --- a/bc/feedback/wagtail_hooks.py +++ b/bc/feedback/wagtail_hooks.py @@ -11,7 +11,7 @@ def register_usefulness_feedback_report_menu_item(): return menu.MenuItem( UsefulnessFeedbackReportView.title, urls.reverse("usefuleness_feedback_report"), - classname="icon icon-" + UsefulnessFeedbackReportView.header_icon, + icon_name=UsefulnessFeedbackReportView.header_icon, order=300, ) @@ -32,7 +32,7 @@ def register_feedback_comment_report_menu_item(): return menu.MenuItem( FeedbackCommentReportView.title, urls.reverse("feedback_comment_report"), - classname="icon icon-" + FeedbackCommentReportView.header_icon, + icon_name=FeedbackCommentReportView.header_icon, order=400, ) diff --git a/bc/project_styleguide/templates/patterns/atoms/icons/icon.html b/bc/project_styleguide/templates/patterns/atoms/icons/icon.html index faff49c3..b0db764a 100644 --- a/bc/project_styleguide/templates/patterns/atoms/icons/icon.html +++ b/bc/project_styleguide/templates/patterns/atoms/icons/icon.html @@ -1,6 +1,6 @@ {# Use with include, e.g. `{% include "patterns/atoms/icons/icon.html" with name="mybutton" classname="icon--stroke button__icon" %}` #} Date: Thu, 16 May 2024 11:35:05 +0800 Subject: [PATCH 41/45] Fix ElasticSearch backend, Remove old backend --- bc/search/elasticsearch5.py | 58 ------------------------------------- bc/search/elasticsearch7.py | 44 +++++++++++++++++++++++++--- bc/settings/base.py | 2 +- docs/infrastructure.md | 2 +- 4 files changed, 42 insertions(+), 64 deletions(-) delete mode 100644 bc/search/elasticsearch5.py diff --git a/bc/search/elasticsearch5.py b/bc/search/elasticsearch5.py deleted file mode 100644 index c5ba8bbf..00000000 --- a/bc/search/elasticsearch5.py +++ /dev/null @@ -1,58 +0,0 @@ -import copy - -from django.conf import settings - -from wagtail.search.backends.elasticsearch5 import ( - Elasticsearch5SearchBackend, - Elasticsearch5SearchQueryCompiler, -) - -from bc.search.utils import get_synonyms - - -class ReduceBoostSearchQueryCompilerMixin: - """ - Mixin for Elasticsearch query compilers that reduce the boost of a given - content type. - - Currently the only content type that receives a negative boost is the - NewsPage content type. The content type is hard coded. The boost reduction - factor is pulled in from a setting. The setting allows to change the reduction - factor without the need to change code. - - If necessary, this could potentially be opened for extension or made more - flexible. - See also: - https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-boosting-query.html - - """ - - def get_inner_query(self): - return { - "boosting": { - "positive": super().get_inner_query(), - "negative": {"term": {"content_type": "news.NewsPage"}}, - "negative_boost": settings.SEARCH_BOOST_FACTOR_NEWS_PAGE, - } - } - - -class SynonymSettingsMixin: - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - self.settings["settings"]["analysis"]["filter"]["synonym"] = { - "type": "synonym", - "synonyms": get_synonyms(), - } - - -class SearchQueryCompiler( - ReduceBoostSearchQueryCompilerMixin, Elasticsearch5SearchQueryCompiler -): - pass - - -class SearchBackend(SynonymSettingsMixin, Elasticsearch5SearchBackend): - settings = copy.deepcopy(Elasticsearch5SearchBackend.settings) - query_compiler_class = SearchQueryCompiler diff --git a/bc/search/elasticsearch7.py b/bc/search/elasticsearch7.py index 16f31094..6449cc28 100644 --- a/bc/search/elasticsearch7.py +++ b/bc/search/elasticsearch7.py @@ -1,14 +1,50 @@ import copy +from django.conf import settings + from wagtail.search.backends.elasticsearch7 import ( Elasticsearch7SearchBackend, Elasticsearch7SearchQueryCompiler, ) -from bc.search.elasticsearch5 import ( - ReduceBoostSearchQueryCompilerMixin, - SynonymSettingsMixin, -) +from bc.search.utils import get_synonyms + + +class ReduceBoostSearchQueryCompilerMixin: + """ + Mixin for Elasticsearch query compilers that reduce the boost of a given + content type. + + Currently the only content type that receives a negative boost is the + NewsPage content type. The content type is hard coded. The boost reduction + factor is pulled in from a setting. The setting allows to change the reduction + factor without the need to change code. + + If necessary, this could potentially be opened for extension or made more + flexible. + See also: + https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-boosting-query.html + + """ + + def get_inner_query(self): + return { + "boosting": { + "positive": super().get_inner_query(), + "negative": {"term": {"content_type": "news.NewsPage"}}, + "negative_boost": settings.SEARCH_BOOST_FACTOR_NEWS_PAGE, + } + } + + +class SynonymSettingsMixin: + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + self.settings["settings"]["analysis"]["filter"]["synonym"] = { + "type": "synonym", + "synonyms": get_synonyms(), + } class SearchQueryCompiler( diff --git a/bc/settings/base.py b/bc/settings/base.py index 417ff9b7..f2e99253 100644 --- a/bc/settings/base.py +++ b/bc/settings/base.py @@ -253,7 +253,7 @@ "default": {"BACKEND": "wagtail.search.backends.database"} } # Reduction factor between 0 and 1 to apply to the relevanve score of search -# results with the NewsPage content type. See bc.search.elasticsearch5. +# results with the NewsPage content type. See bc.search.elasticsearch7. SEARCH_BOOST_FACTOR_NEWS_PAGE = float(env.get("SEARCH_BOOST_FACTOR_NEWS_PAGE", 0.5)) diff --git a/docs/infrastructure.md b/docs/infrastructure.md index d8103940..026d33fb 100644 --- a/docs/infrastructure.md +++ b/docs/infrastructure.md @@ -54,7 +54,7 @@ This was undesirable, because news can be outdated and in the worst case plain w To address this issue, multiple approaches (separate news search, no news in search, order news by date in results) were discussed. It was decided that news should still be discoverable through search but should rank much lower than other content, because of their time-limited value. -To achieve a generally lower ranking of the `NewsPage` type, a query compiler mixin (`bc.search.elasticsearch5`) has been added that allows to apply a negative boost factor to search results with the content type `news.NewsPage`. +To achieve a generally lower ranking of the `NewsPage` type, a query compiler mixin (`bc.search.elasticsearch7`) has been added that allows to apply a negative boost factor to search results with the content type `news.NewsPage`. This negative boost factor (which has to be a float between 0 and 1) can be defined throught the environment variable `SEARCH_BOOST_FACTOR_NEWS_PAGE` but defaults to 0.5. The negative boost factor is used to multiply the relevance score of a given search result, if that search result matches the content type `news.NewsPage`. From f268277a7c9880552cbc717023ad969630d0382c Mon Sep 17 00:00:00 2001 From: Victor Miti Date: Wed, 29 May 2024 10:50:58 +0100 Subject: [PATCH 42/45] Ensure table_header_choice is not empty In Wagtail 6.0, the TableBlock header controls were switched to a field (`table_header_choice`) that requires user input. References: - https://docs.wagtail.org/en/stable/releases/6.0.html#accessibility-improvements - https://github.com/wagtail/wagtail/blob/ab9d1edb/wagtail/contrib/table_block/blocks.py#L162 - https://github.com/wagtail/wagtail/blob/ab9d1edb/wagtail/contrib/table_block/blocks.py#L131-L134 This ensures that `table_header_choice` is not empty, otherwise, a ValidationError is raised --- bc/utils/blocks.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bc/utils/blocks.py b/bc/utils/blocks.py index 90d63f30..8249c2e1 100644 --- a/bc/utils/blocks.py +++ b/bc/utils/blocks.py @@ -305,6 +305,22 @@ def clean_table_values(self, table): return cleaned_table + def clean(self, value): + """ + In Wagtail 6.0, the TableBlock header controls were switched to + a field (`table_header_choice`) that requires user input. + + References: + - https://docs.wagtail.org/en/stable/releases/6.0.html#accessibility-improvements + - https://github.com/wagtail/wagtail/blob/ab9d1edb/wagtail/contrib/table_block/blocks.py#L162 + - https://github.com/wagtail/wagtail/blob/ab9d1edb/wagtail/contrib/table_block/blocks.py#L131-L134 + + This ensures that `table_header_choice` is not empty, + otherwise, a ValidationError is raised + """ + value["table_header_choice"] = "both" + return super().clean(value) + class Meta: abstract = True template = "patterns/molecules/streamfield/blocks/chart_block.html" From cc1c684c4f5c3692e946b1544843f6b7c8e820f2 Mon Sep 17 00:00:00 2001 From: Victor Miti Date: Thu, 30 May 2024 13:13:11 +0100 Subject: [PATCH 43/45] Add note on why we set `table_header_choice` to "both" --- bc/utils/blocks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bc/utils/blocks.py b/bc/utils/blocks.py index 8249c2e1..6af3890a 100644 --- a/bc/utils/blocks.py +++ b/bc/utils/blocks.py @@ -316,7 +316,10 @@ def clean(self, value): - https://github.com/wagtail/wagtail/blob/ab9d1edb/wagtail/contrib/table_block/blocks.py#L131-L134 This ensures that `table_header_choice` is not empty, - otherwise, a ValidationError is raised + otherwise, a ValidationError is raised. + + Since the chart blocks *always* have row and column labels, + we set the value of `table_header_choice` to "both" """ value["table_header_choice"] = "both" return super().clean(value) From 9db90b72257a8c9a7b5ae0347c412ca41bf3cd18 Mon Sep 17 00:00:00 2001 From: Victor Miti Date: Mon, 3 Jun 2024 11:52:11 +0100 Subject: [PATCH 44/45] Wagtail 6.0.5 https://docs.wagtail.org/en/latest/releases/6.0.5.html --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 25b3bd86..89104007 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2382,13 +2382,13 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess [[package]] name = "wagtail" -version = "6.0.3" +version = "6.0.5" description = "A Django content management system." optional = false python-versions = ">=3.8" files = [ - {file = "wagtail-6.0.3-py3-none-any.whl", hash = "sha256:673337cdb1f96ebe5cb063472cff96a28cab488dc4ccf1de5b38901c289803ff"}, - {file = "wagtail-6.0.3.tar.gz", hash = "sha256:bfcea95b7de879197fa2bc26810fe5fae78e616056ad8d09b3f66b1604c456a9"}, + {file = "wagtail-6.0.5-py3-none-any.whl", hash = "sha256:c66a66202291e7ed2c1bd48e7a78913663a3cd158e91ff08af75d503c0ce604a"}, + {file = "wagtail-6.0.5.tar.gz", hash = "sha256:adde9c0cb85400664c74fdbee4052db6f747412c589f06c4a317e8bc103fa0ec"}, ] [package.dependencies] From d8d2029488ed250f630a2e2be7b44992310a5067 Mon Sep 17 00:00:00 2001 From: Victor Miti Date: Mon, 3 Jun 2024 11:52:45 +0100 Subject: [PATCH 45/45] Prepare for release 71.00 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c56f64b..c9f69876 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ Compare: +## 71.00 (2024-06-03) + +[Wagtail 6.0](https://docs.wagtail.org/en/latest/releases/6.0.html) upgrade + +Compare: + ## 70.01 (2024-04-03) - Update `flake8` to version 3.8.4 for Python 3.8 compatibility