Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migration from 2.2 -> 3.2 -> 4.2 #2520

Merged
merged 24 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a1007f2
feat: initial 2.2 -> 4.2 migration work
JacobCoffee Mar 19, 2024
6907c68
feat: minimum dependency changes required to get a live webserver:por…
JacobCoffee Mar 19, 2024
e947a2c
test(minutes): fixed minutes test
JacobCoffee Mar 19, 2024
0ff5603
test(mailing): fixed mailing test
JacobCoffee Mar 19, 2024
b9d2708
test(codesamples): fixed codesamples tests
JacobCoffee Mar 19, 2024
e6ec528
test(downloads): fixed downloads tests
JacobCoffee Mar 19, 2024
bb7c371
test(pages): fixed pages tests
JacobCoffee Mar 19, 2024
445b8d3
test(successstories): fixed successstories tests
JacobCoffee Mar 19, 2024
17647fc
test(users): fixed users forms tests
JacobCoffee Mar 20, 2024
34f501b
test(events): fixed events tests
JacobCoffee Mar 20, 2024
a411e4b
test(users): fixed users views tests
JacobCoffee Mar 20, 2024
842e068
chore: hide my shame
JacobCoffee Mar 20, 2024
9c9dbfa
chore: apply code review
JacobCoffee Mar 21, 2024
5687dc9
harmonize docker-compose and ci.yml PG versions to prod
ewdurbin Apr 18, 2024
b78df42
Update base-requirements.txt
JacobCoffee Jun 29, 2024
e6858ef
chore: remove migrations, rebase latest
JacobCoffee Sep 4, 2024
0557f03
chore: apply code review
JacobCoffee Sep 5, 2024
3a74cba
feat(db): generate migrations
JacobCoffee Sep 5, 2024
1a62b71
fix: revert allauth version bump
JacobCoffee Sep 9, 2024
8423725
fix: revert allauth account middlware used in later versions
JacobCoffee Sep 9, 2024
ab1dc94
chore: bump allauth version
JacobCoffee Sep 10, 2024
b3bd496
Fixup tests that interact with django-allauth ACCOUNT_PREVENT_ENUMERA…
ewdurbin Sep 11, 2024
e49e356
Merge branch 'main' into 4.2
JacobCoffee Sep 12, 2024
d1c3ce8
chore: bump django package version
JacobCoffee Sep 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.1
image: postgres:15.3
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand Down
1 change: 0 additions & 1 deletion banners/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'banners.apps.BannersAppConfig'
21 changes: 10 additions & 11 deletions base-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
dj-database-url==0.5.0
django-pipeline==2.0.6
django-sitetree==1.18.0
django-pipeline==3.0.0 # 3.0.0 is first version that supports Django 4.2
django-sitetree==1.18.0 # >=1.17.1 is (?) first version that supports Django 4.2
django-apptemplates==1.5
django-admin-interface==0.24.2
django-translation-aliases==0.1.0
Django==2.2.28
Django==4.2.16
docutils==0.12
Markdown==3.3.4
cmarkgfm==0.6.0
Expand All @@ -22,32 +22,31 @@ chardet==4.0.0
celery[redis]==5.3.6
django-celery-beat==2.5.0
# TODO: We may drop 'django-imagekit' completely.
django-imagekit==4.0.2
django-imagekit==5.0 # 5.0 is first version that supports Django 4.2
django-haystack==3.2.1
elasticsearch>=7,<8
# TODO: 0.14.0 only supports Django 1.8 and 1.11.
django-tastypie==0.14.3
django-tastypie==0.14.6 # 0.14.6 is first version that supports Django 4.2

pytz==2021.1
python-dateutil==2.8.2

requests[security]>=2.26.0

django-honeypot==1.0.1
django-markupfield==2.0.0
django-markupfield-helpers==0.1.1
django-honeypot==1.0.4 # 1.0.4 is first version that supports Django 4.2
django-markupfield==2.0.1

django-allauth==0.50.0
django-allauth==0.57.2 # 0.55.0 is first version that supports Django 4.2

django-waffle==2.2.1

djangorestframework==3.12.2
djangorestframework==3.14.0 # 3.14.0 is first version that supports Django 4.1, 4.2 support hasnt been "released"
django-filter==2.4.0
django-ordered-model==3.4.3
django-widget-tweaks==1.4.8
django-countries==7.2.1
num2words==0.5.10
django-polymorphic==3.0.0
django-polymorphic==3.1.0 # 3.1.0 is first version that supports Django 4.0, unsure if it fully supports 4.2
sorl-thumbnail==12.7.0
django-extensions==3.1.4
django-import-export==2.7.1
Expand Down
1 change: 0 additions & 1 deletion blogs/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'blogs.apps.BlogsAppConfig'
4 changes: 3 additions & 1 deletion blogs/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ class BlogEntryAdmin(admin.ModelAdmin):
date_hierarchy = 'pub_date'
actions = ['sync_new_entries']

@admin.action(
description="Sync new blog entries"
)
def sync_new_entries(self, request, queryset):
call_command('update_blogs')
self.message_user(request, "Blog entries updated.")

sync_new_entries.short_description = "Sync new blog entries"


@admin.register(FeedAggregate)
Expand Down
26 changes: 26 additions & 0 deletions blogs/migrations/0003_alter_relatedblog_creator_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.11 on 2024-09-05 17:10

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('blogs', '0002_remove_translations_and_contributors'),
]

operations = [
migrations.AlterField(
model_name='relatedblog',
name='creator',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='relatedblog',
name='last_modified_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_modified', to=settings.AUTH_USER_MODEL),
),
]
4 changes: 2 additions & 2 deletions blogs/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from django.conf import settings
from django.template.loader import render_to_string
from django.utils.timezone import make_aware, utc
from django.utils.timezone import make_aware

from boxes.models import Box
from .models import BlogEntry, Feed
Expand All @@ -16,7 +16,7 @@ def get_all_entries(feed_url):

for e in d['entries']:
published = make_aware(
datetime.datetime(*e['published_parsed'][:7]), timezone=utc
datetime.datetime(*e['published_parsed'][:7]), timezone=datetime.timezone.utc
)

entry = {
Expand Down
1 change: 0 additions & 1 deletion boxes/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'boxes.apps.BoxesAppConfig'
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.11 on 2024-09-05 17:10

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('boxes', '0003_auto_20171101_2138'),
]

operations = [
migrations.AlterField(
model_name='box',
name='creator',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='box',
name='last_modified_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_modified', to=settings.AUTH_USER_MODEL),
),
]
1 change: 0 additions & 1 deletion cms/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'cms.apps.CmsAppConfig'
1 change: 0 additions & 1 deletion codesamples/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'codesamples.apps.CodesamplesAppConfig'
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.11 on 2024-09-05 17:10

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('codesamples', '0003_auto_20170821_2000'),
]

operations = [
migrations.AlterField(
model_name='codesample',
name='creator',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='codesample',
name='last_modified_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_modified', to=settings.AUTH_USER_MODEL),
),
]
6 changes: 2 additions & 4 deletions codesamples/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ def setUp(self):
is_published=False)

def test_published(self):
self.assertQuerysetEqual(CodeSample.objects.published(),
['<CodeSample: Copy One>'])
self.assertQuerySetEqual(CodeSample.objects.published(),['<CodeSample: Copy One>'], transform=repr)

def test_draft(self):
self.assertQuerysetEqual(CodeSample.objects.draft(),
['<CodeSample: Copy Two>'])
self.assertQuerySetEqual(CodeSample.objects.draft(),['<CodeSample: Copy Two>'], transform=repr)
1 change: 0 additions & 1 deletion community/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'community.apps.CommunityAppConfig'
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Generated by Django 4.2.11 on 2024-09-05 17:10

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('community', '0001_squashed_0004_auto_20170831_0541'),
]

operations = [
migrations.AlterField(
model_name='link',
name='creator',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='link',
name='last_modified_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_modified', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='link',
name='post',
field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='related_%(class)s', to='community.post'),
),
migrations.AlterField(
model_name='photo',
name='creator',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='photo',
name='last_modified_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_modified', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='photo',
name='post',
field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='related_%(class)s', to='community.post'),
),
migrations.AlterField(
model_name='post',
name='creator',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='post',
name='last_modified_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_modified', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='post',
name='meta',
field=models.JSONField(blank=True, default=dict),
),
migrations.AlterField(
model_name='video',
name='creator',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='video',
name='last_modified_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_modified', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='video',
name='post',
field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='related_%(class)s', to='community.post'),
),
]
2 changes: 1 addition & 1 deletion community/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.contrib.postgres.fields import JSONField
from django.db.models import JSONField
from django.urls import reverse
from django.db import models
from django.utils.translation import gettext_lazy as _
Expand Down
6 changes: 3 additions & 3 deletions community/tests/test_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ def test_post_manager(self):
status=Post.STATUS_PUBLIC
)

self.assertQuerysetEqual(Post.objects.all(), [public_post, private_post], lambda x: x)
self.assertQuerysetEqual(Post.objects.public(), [public_post], lambda x: x)
self.assertQuerysetEqual(Post.objects.private(), [private_post], lambda x: x)
self.assertQuerySetEqual(Post.objects.all(), [public_post, private_post], lambda x: x)
self.assertQuerySetEqual(Post.objects.public(), [public_post], lambda x: x)
self.assertQuerySetEqual(Post.objects.private(), [private_post], lambda x: x)
1 change: 0 additions & 1 deletion companies/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'companies.apps.CompaniesAppConfig'
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.9"

services:
postgres:
image: postgres:10-bullseye
image: postgres:15.3-bullseye
ports:
- "5433:5432"
environment:
Expand Down
1 change: 0 additions & 1 deletion downloads/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'downloads.apps.DownloadsAppConfig'
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Generated by Django 4.2.11 on 2024-09-05 17:10

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('downloads', '0010_releasefile_sbom_spdx2_file'),
]

operations = [
migrations.AlterField(
model_name='os',
name='creator',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='os',
name='last_modified_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_modified', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='release',
name='creator',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='release',
name='last_modified_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_modified', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='releasefile',
name='creator',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='releasefile',
name='last_modified_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_modified', to=settings.AUTH_USER_MODEL),
),
]
Loading