Skip to content

Commit

Permalink
Merge branch 'release' into 'master'
Browse files Browse the repository at this point in the history
Release 77.0 » Wagtail 6.1 Upgrade

See merge request buckinghamshire-council/bc!730
  • Loading branch information
engineervix committed Jul 29, 2024
2 parents a5758e0 + 488269b commit b598c66
Show file tree
Hide file tree
Showing 14 changed files with 775 additions and 372 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ poetry:
image: python:3.8-bullseye
stage: build
variables:
POETRY_VERSION: 1.8.2
POETRY_VERSION: 1.8.3
script:
- pip install poetry==$POETRY_VERSION
- python -m venv venv
Expand Down Expand Up @@ -134,7 +134,7 @@ test_python:
- postgres:13.10
variables:
# Run tests with the production settings.
DJANGO_SETTINGS_MODULE: bc.settings.production
DJANGO_SETTINGS_MODULE: bc.settings.test

# SECRET_KEY is required by Django to start.
SECRET_KEY: fake_secret_key_to_run_tests
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ repos:
poetry.lock
)$
- repo: https://github.com/adamchainz/django-upgrade
rev: '1.16.0' # replace with latest tag on GitHub
rev: '1.19.0' # replace with latest tag on GitHub
hooks:
- id: django-upgrade
args: [--target-version, '4.2'] # Replace with Django version
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Release History

## Unreleased

- ...

## 77.0 (2024-07-29)

Compare: <https://git.torchbox.com/buckinghamshire-council/bc/compare/76.0...77.0>

- [Wagtail 6.1](https://docs.wagtail.org/en/latest/releases/6.1.html) upgrade

## 76.0 (2024-07-23)

Compare: <https://git.torchbox.com/buckinghamshire-council/bc/compare/75.0...76.0>
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.8.2
ARG POETRY_VERSION=1.8.3

# Install dependencies in a virtualenv
ENV VIRTUAL_ENV=/venv
Expand Down
4 changes: 2 additions & 2 deletions bc/cases/backends/respond/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_attaching_one_file(self):
soup = BeautifulSoup(etree.tostring(form.get_xml(form.cleaned_data)), "xml")
self.maxDiff = None
self.assertEqual(
soup.find("Activities").prettify(),
soup.find("Activities").prettify().strip("\n"),
textwrap.dedent(
"""\
<Activities>
Expand Down Expand Up @@ -158,7 +158,7 @@ def test_attaching_multiple_files(self):
soup = BeautifulSoup(etree.tostring(form.get_xml(form.cleaned_data)), "xml")
self.maxDiff = None
self.assertEqual(
soup.find("Activities").prettify(),
soup.find("Activities").prettify().strip("\n"),
textwrap.dedent(
"""\
<Activities>
Expand Down
14 changes: 7 additions & 7 deletions bc/feedback/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ def test_view_filters_have_results(self):
request = factory.get(
self.url,
{
"created_after": "2024-01-08",
"created_before": "2024-01-10",
"created_from": "2024-01-08",
"created_to": "2024-01-10",
"useful": True,
},
)
Expand All @@ -419,8 +419,8 @@ def test_view_filters_have_results(self):
request = factory.get(
self.url,
{
"created_after": "2024-01-08",
"created_before": "2024-01-10",
"created_from": "2024-01-08",
"created_to": "2024-01-10",
"useful": False,
},
)
Expand All @@ -440,7 +440,7 @@ def test_view_filters_have_no_results(self):
# Create a request with date filters without hits
request = factory.get(
self.url,
{"created_after": "2024-01-10"},
{"created_from": "2024-01-10"},
)

# Set the request user
Expand Down Expand Up @@ -484,7 +484,7 @@ def test_view_date_filter_has_results(self):
# Create a request with date filters with expected hits
request = factory.get(
self.url,
{"created_after": "2024-01-08", "created_before": "2024-01-10"},
{"created_from": "2024-01-08", "created_to": "2024-01-10"},
)

# Set the request user
Expand All @@ -506,7 +506,7 @@ def test_view_date_filter_has_no_results(self):
factory = RequestFactory()

# Create a request with date filters without hits
request = factory.get(self.url, {"created_after": "2024-01-10"})
request = factory.get(self.url, {"created_from": "2024-01-10"})

# Set the request user
request.user = self.user
Expand Down
6 changes: 5 additions & 1 deletion bc/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
# SecurityMiddleware.
# http://whitenoise.evans.io/en/stable/#quickstart-for-django-apps
"whitenoise.middleware.WhiteNoiseMiddleware",
"xff.middleware.XForwardedForMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"bc.utils.middleware.CustomCsrfViewMiddleware",
Expand Down Expand Up @@ -446,6 +447,7 @@
"level": "WARNING",
"propagate": False,
},
"xff": {"handlers": ["console"], "level": "WARNING", "propagate": False},
},
}

Expand Down Expand Up @@ -715,6 +717,8 @@

BASIC_AUTH_DISABLE_CONSUMING_AUTHORIZATION_HEADER = True

XFF_TRUSTED_PROXY_DEPTH = int(env.get("XFF_TRUSTED_PROXY_DEPTH", 1))

AUTH_USER_MODEL = "users.User"

# Wagtail settings
Expand Down Expand Up @@ -756,7 +760,7 @@
WAGTAILDOCS_DOCUMENT_MODEL = "documents.CustomDocument"


PASSWORD_REQUIRED_TEMPLATE = "patterns/pages/wagtail/password_required.html"
WAGTAIL_PASSWORD_REQUIRED_TEMPLATE = "patterns/pages/wagtail/password_required.html"


# Default field for automatic primary keys. (Introduced in Django 3.2)
Expand Down
3 changes: 3 additions & 0 deletions bc/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@
# Ensure that the CSRF cookie is only sent by browsers under an HTTPS connection.
# https://docs.djangoproject.com/en/stable/ref/settings/#csrf-cookie-secure
CSRF_COOKIE_SECURE = True

# Error if there aren't enough proxies in between
XFF_ALWAYS_PROXY = True
27 changes: 27 additions & 0 deletions bc/settings/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from .base import * # noqa

SECRET_KEY = "fake_secret_key_to_run_tests"

RECAPTCHA_PUBLIC_KEY = "dummy_public_key"
RECAPTCHA_PRIVATE_KEY = "dummy_private_key"

RESPOND_COMPLAINTS_WEBSERVICE = "TestCreateComplaints"
RESPOND_FOI_WEBSERVICE = "TestCreateFOI"
RESPOND_SAR_WEBSERVICE = "TestCreateSAR"
RESPOND_COMMENTS_WEBSERVICE = "TestCreateComments"
RESPOND_COMPLIMENTS_WEBSERVICE = "TestCreateCompliments"
RESPOND_DISCLOSURES_WEBSERVICE = "TestCreateDisclosures"

SECURE_SSL_REDIRECT = False

WAGTAILSEARCH_BACKENDS = {"default": {"BACKEND": "wagtail.search.backends.database"}}

CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.db.DatabaseCache",
"LOCATION": "database_cache",
}
}

# Ignore proxy count in tests
XFF_ALWAYS_PROXY = False
26 changes: 26 additions & 0 deletions docs/technical-debt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Technical debt

This page describes known technical debt or shortcomings in the project.

## Non-family info sites and pages using `family_info` Django application's code

There are subsites set up using `family_info` Django application's models that are not family info subsite.

A likely good idea would be to refactor the `family_info` Django application to be more generic
and move the family info specific code to a separate Django application.

This may be especially confusing for new developers trying to find their way in the codebase.

Short-term actions to address:

- Any FIS-named code should be reviewed and checked if it should be called something else.
- Add comments around FIS-named things whether they are actually FIS-specific.
- Document this somewhere else

Ideally:

- Formulate plan for renaming the code.
- Migrate existing subsites to use generic, non-FIS code as much as possible.
- Any new subsites should use generic, non-FIS code only.

We don't want to be in situation where FIS-specific code is used for non-FIS subsites.
2 changes: 1 addition & 1 deletion fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def run_test(c):
"python",
"manage.py",
"test",
"--settings=bc.settings.production",
"--settings=bc.settings.test",
]
)

Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ nav:
- 'Location maps widget': 'location-maps-widget.md'
- 'Postcode lookup': 'postcode-lookup.md'
- 'Contributing': 'contributing.md'
- 'Technical debt': technical-debt.md
- 'CHANGELOG': 'CHANGELOG.md'
Loading

0 comments on commit b598c66

Please sign in to comment.