Compare commits

...
Sign in to create a new pull request.

7 commits

Author SHA1 Message Date
PCoder
751438f5eb Merge remote-tracking branch 'origin/master' into upgrade/django5.2-wagtail7.0 2026-03-19 00:06:22 +05:30
PCoder
e112569f11 Remove upgrade-publichealth.md from tracking and add upgrade* to .gitignore 2026-03-15 01:30:35 +05:30
PCoder
8575d26739 Fix startup warnings: naive datetime and WAGTAILADMIN_BASE_URL
- Replace datetime.datetime.now() with timezone.now() in
  feedler/models/models.py and publichealth/home/models/models.py
  (fixes RuntimeWarning about naive datetime with USE_TZ=True)
- Add WAGTAILADMIN_BASE_URL to dev.py and production.py
  (fixes wagtailadmin.W003 warning)
- All checks pass with -Wall, no warnings remain except
  third-party guess_language PyEnchant ImportWarning
2026-03-15 01:23:49 +05:30
PCoder
b5229e1eaf Upgrade Django 5.1.9 → 5.2.1 LTS + bump all dependencies
- Bump Django from 5.1.9 to 5.2.1 (target LTS, supported until April 2028)
- Bump django-anymail 11.0 → 12.0, django-colorful 1.3 → 1.4.0,
  django-crispy-forms 2.3 → 2.5, django-el-pagination 3.3.0 → 4.1.2,
  django-taggit >=5.0 → >=6.0, Pillow 10.4.0 → 11.1.0
- Remove django-filter <25 pin (no longer needed with Django 5.2)
- Add missing django-libsass==0.9 to requirements (SCSS compilation)
- No new migrations needed, all checks pass
- HTTP smoke tests: homepage, admin, search all return 200
2026-03-15 01:12:15 +05:30
PCoder
95edd2ab88 Upgrade Django 5.0.9 → 5.1.9
- Bump Django from 5.0.9 to 5.1.9 (intermediate step toward 5.2 LTS)
- Generate migrations for BigAutoField id fields and updated field definitions
- No code changes needed (STORAGES already used, no index_together)
- All checks pass, migrations applied cleanly
2026-03-15 01:08:33 +05:30
PCoder
5f1653bb6b Upgrade Wagtail 6.3.1 → 7.0.2 LTS
- Bump wagtail to 7.0.2 (target LTS)
- Bump wagtail-modeladmin to 2.2.0 (Wagtail 7.0 support)
- Bump django-filter to >=24.0,<25
- Switch elasticsearch backend from elasticsearch5 to elasticsearch7
  (elasticsearch5 backend removed in Wagtail 7.0)
- All checks pass, 1 migration applied cleanly
2026-03-15 01:06:53 +05:30
PCoder
2bee4e8904 Upgrade Wagtail 6.0.6 → 6.3.1 LTS
- Rename PASSWORD_REQUIRED_TEMPLATE to WAGTAIL_PASSWORD_REQUIRED_TEMPLATE
  (deprecated in Wagtail 6.1, removed in 7.0)
- Bump wagtail from 6.0.6 to 6.3.1 (previous LTS)
- All checks pass, 7 new migrations applied cleanly
2026-03-15 01:04:25 +05:30
9 changed files with 128 additions and 36 deletions

1
.gitignore vendored
View file

@ -20,3 +20,4 @@ env
/publichealth/static/libs
publichealth.home.json
.history
upgrade*

View file

@ -0,0 +1,28 @@
# Generated by Django 5.1.9 on 2026-03-14 19:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('feedler', '0009_entry_expire_at'),
]
operations = [
migrations.AlterField(
model_name='entry',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
migrations.AlterField(
model_name='feedlysettings',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
migrations.AlterField(
model_name='stream',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
]

View file

@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
import datetime
from django.db import models
from django.utils import translation
from django.utils import timezone, translation
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.utils.translation import gettext_lazy as _
from wagtail.models import Page, Orderable # wagtail.core moved to wagtail in v3+
@ -75,7 +73,7 @@ class FeedPage(Page):
def feedentries(self):
if self.stream:
entries = Entry.objects.filter(stream=self.stream).filter(
models.Q(expire_at__isnull=True) | models.Q(expire_at__gt=datetime.datetime.now())
models.Q(expire_at__isnull=True) | models.Q(expire_at__gt=timezone.now())
)
else:
entries = Entry.objects.all()

View file

@ -0,0 +1,64 @@
# Generated by Django 5.1.9 on 2026-03-14 19:37
import wagtail.contrib.forms.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0037_auto_20230516_1241'),
]
operations = [
migrations.AlterField(
model_name='articlerelatedlink',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
migrations.AlterField(
model_name='contact',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
migrations.AlterField(
model_name='contactform',
name='from_address',
field=models.EmailField(blank=True, max_length=255, verbose_name='from address'),
),
migrations.AlterField(
model_name='contactform',
name='to_address',
field=models.CharField(blank=True, help_text='Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.', max_length=255, validators=[wagtail.contrib.forms.models.validate_to_address], verbose_name='to address'),
),
migrations.AlterField(
model_name='contactformfield',
name='choices',
field=models.TextField(blank=True, help_text='Comma or new line separated list of choices. Only applicable in checkboxes, radio and dropdown.', verbose_name='choices'),
),
migrations.AlterField(
model_name='contactformfield',
name='default_value',
field=models.TextField(blank=True, help_text='Default value. Comma or new line separated values supported for checkboxes.', verbose_name='default value'),
),
migrations.AlterField(
model_name='contactformfield',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
migrations.AlterField(
model_name='dataletssettings',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
migrations.AlterField(
model_name='socialcontact',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
migrations.AlterField(
model_name='socialcontact',
name='network',
field=models.CharField(choices=[('twitter', 'Twitter'), ('facebook', 'Facebook'), ('linkedin', 'LinkedIn')], default='twitter', max_length=16),
),
]

View file

@ -2,10 +2,8 @@
from __future__ import unicode_literals
import datetime
from django.db import models
from django.utils import translation
from django.utils import timezone, translation
from django.conf import settings
from modelcluster.fields import ParentalKey
@ -367,7 +365,7 @@ class HomePage(Page):
def newsentries(self):
# Get the last few news entries for the home page
entries = Entry.objects.filter(
models.Q(expire_at__isnull=True) | models.Q(expire_at__gt=datetime.datetime.now())
models.Q(expire_at__isnull=True) | models.Q(expire_at__gt=timezone.now())
).all().order_by('-published')
# Filter out by current language
curlang = translation.get_language()

View file

@ -152,7 +152,7 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
PASSWORD_REQUIRED_TEMPLATE = 'password.html'
WAGTAIL_PASSWORD_REQUIRED_TEMPLATE = 'password.html'
# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/

View file

@ -14,6 +14,7 @@ ALLOWED_HOSTS = ['*']
INTERNAL_IPS = ('127.0.0.1', '10.0.2.2')
BASE_URL = 'http://localhost:8000'
WAGTAILADMIN_BASE_URL = 'http://localhost:8000'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

View file

@ -48,6 +48,7 @@ if 'ALLOWED_HOSTS' in env:
if 'PRIMARY_HOST' in env:
BASE_URL = 'http://%s/' % env['PRIMARY_HOST']
WAGTAILADMIN_BASE_URL = 'https://%s' % env['PRIMARY_HOST']
# Also add PRIMARY_HOST to CSRF_TRUSTED_ORIGINS
CSRF_TRUSTED_ORIGINS = ['https://%s' % env['PRIMARY_HOST'], 'http://%s' % env['PRIMARY_HOST']]
@ -131,7 +132,7 @@ if REDIS_LOCATION is not None:
if 'ELASTICSEARCH_URL' in env:
WAGTAILSEARCH_BACKENDS = {
'default': {
'BACKEND': 'wagtail.search.backends.elasticsearch5',
'BACKEND': 'wagtail.search.backends.elasticsearch7',
'URLS': [env['ELASTICSEARCH_URL']],
'INDEX': APP_NAME,
'ATOMIC_REBUILD': True,

View file

@ -1,33 +1,34 @@
# Updated: 2025-09-18 - Django 5.0 Upgrade
# Updated: 2026-03-15 - Django 5.2 LTS + Wagtail 7.0 LTS Upgrade
# Core
Django==5.0.9 # Django 5.0 (latest stable in 5.0 series)
wagtail==6.0.6 # Wagtail 6.0 supports Django 5.0
elasticsearch==7.17.9 # Compatible with Django 5.0
Django==5.2.1 # Django 5.2 LTS (target)
wagtail==7.0.2 # Wagtail 7.0 LTS (target)
elasticsearch==7.17.9 # Compatible with Django 5.2
# Database
psycopg2-binary==2.9.10 # Compatible with Django 5.0 and Python 3.13
dj-database-url==2.2.0 # Updated for Django 5.0
psycopg2-binary==2.9.10 # Compatible with Django 5.2 and Python 3.13
dj-database-url==2.2.0 # Updated for Django 5.2
# Content
# Note: puput needs update or replacement for Wagtail 6.x
# Note: puput needs update or replacement for Wagtail 7.x
# puput==2.0.0
guess-language-spirit==0.5.3
# Caching
django-redis==5.4.0 # Compatible with Django 5.0
django-redis==5.4.0 # Compatible with Django 5.2
redis==5.0.8
# Frontend
django-anymail==11.0 # Updated for Django 5.0
django-colorful==1.3
django-contrib-comments==2.2.0 # May need testing with Django 5.0
django-crispy-forms==2.3 # Updated for Django 5.0
django-el-pagination==3.3.0
django-compressor==4.5.1 # Updated for Django 5.0
django-social-share==2.3.0 # May need testing with Django 5.0
libsass==0.23.0 # Updated version
Pillow==10.4.0 # Updated for Django 5.0 and Python 3.12+
django-anymail==12.0 # Updated for Django 5.2
django-colorful==1.4.0 # Updated for Django 5.2
django-contrib-comments==2.2.0 # Kept as-is (unused in templates)
django-crispy-forms==2.5 # Updated for Django 5.2
django-el-pagination==4.1.2 # Updated (latest available)
django-compressor==4.5.1 # Compatible with Django 5.2
django-social-share==2.3.0 # Compatible with Django 5.2
libsass==0.23.0
django-libsass==0.9 # Required by COMPRESS_PRECOMPILERS setting
Pillow==11.1.0 # Updated for Django 5.2 and Python 3.13
# Runtime dependencies
gunicorn
@ -36,19 +37,19 @@ python-dotenv
#ConcurrentLogHandler
unidecode
# Additional dependencies for Django 5.0 and Wagtail 6
# Additional dependencies for Django 5.2 and Wagtail 7.0
django-configurations
django-taggit>=5.0.0 # Required by Wagtail 6
wagtail-modeladmin==2.0.0 # Separate package for ModelAdmin in Wagtail 5+
django-taggit>=6.0.0 # Required by Wagtail 7.0
wagtail-modeladmin==2.2.0 # Separate package for ModelAdmin (supports Wagtail 7.0)
djangorestframework>=3.15.0 # Required by Wagtail API
django-modelcluster>=6.3 # Required by Wagtail 6
django-treebeard>=4.7 # Required by Wagtail 6
django-filter>=23.3,<24 # Required by Wagtail 6.0.6 (must be <24)
django-modelcluster>=6.3 # Required by Wagtail 7.0
django-treebeard>=4.7 # Required by Wagtail 7.0
django-filter>=24.0 # Required by Wagtail 7.0
Willow>=1.8.0 # Required by Wagtail for images
beautifulsoup4>=4.12.0 # Required by Wagtail
html5lib>=1.1 # Required by Wagtail
openpyxl>=3.1.0 # For Excel export support
l18n # For Wagtail localization
telepath>=0.3.1 # Required by Wagtail 6
# Django 5.0 timezone support (replaces pytz)
tzdata # For timezone support in Django 5.0
telepath>=0.3.1 # Required by Wagtail 7.0
# Django 5.x timezone support (replaces pytz)
tzdata # For timezone support in Django 5.x