-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Upgrade backend (Python, Django, Wagtail) (#350)
* Upgrade to Django 4.0 * Drop django-compressor and django-libsass * Upgrade to Wagtail 4.2 * Upgrade to Django 4.1 * Upgrade to Python 3.11 * Test a simple search query * Upgrade to Wagtail 5.0 * Upgrade to Django 4.2 * Upgrade to Wagtail 5.1 * Upgrade to Wagtail 5.2 * Upgrade to Python 3.12 * Switch from psycopg2-binary to psycopg2 * Remove unhelpful version pins
- Loading branch information
Showing
21 changed files
with
194 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
ietf/images/migrations/0003_wagtail_42_wagtailimagefield.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 4.0.10 on 2023-11-29 10:19 | ||
|
||
from django.db import migrations | ||
import wagtail.images.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('images', '0002_alter_ietfimage_file_hash'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='ietfimage', | ||
name='file', | ||
field=wagtail.images.models.WagtailImageField(height_field='height', upload_to=wagtail.images.models.get_upload_to, verbose_name='file', width_field='width'), | ||
), | ||
migrations.AlterField( | ||
model_name='ietfrendition', | ||
name='file', | ||
field=wagtail.images.models.WagtailImageField(height_field='height', upload_to=wagtail.images.models.get_rendition_upload_to, width_field='width'), | ||
), | ||
] |
19 changes: 19 additions & 0 deletions
19
ietf/images/migrations/0004_django_42_rendition_storage.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 4.2.7 on 2023-11-29 12:17 | ||
|
||
from django.db import migrations | ||
import wagtail.images.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('images', '0003_wagtail_42_wagtailimagefield'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='ietfrendition', | ||
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'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
from django.test import TestCase | ||
from django.urls import reverse | ||
from wagtail.models import Page, Site | ||
|
||
from ..blog.models import BlogIndexPage, BlogPage | ||
from ..home.models import HomePage | ||
|
||
|
||
class SearchTests(TestCase): | ||
def test_search(self): | ||
|
||
root = Page.get_first_root_node() | ||
|
||
home = HomePage( | ||
slug="homepageslug", | ||
title="home page title", | ||
heading="home page heading", | ||
introduction="home page introduction", | ||
request_for_comments_section_body="rfc section body", | ||
working_groups_section_body="wg section body", | ||
) | ||
|
||
root.add_child(instance=home) | ||
|
||
Site.objects.all().delete() | ||
|
||
Site.objects.create( | ||
hostname="localhost", | ||
root_page=home, | ||
is_default_site=True, | ||
site_name="testingsitename", | ||
) | ||
|
||
blogindex = BlogIndexPage( | ||
slug="blog", | ||
title="blog index title", | ||
) | ||
home.add_child(instance=blogindex) | ||
|
||
blog = BlogPage( | ||
slug="blogpost", | ||
title="blog title", | ||
introduction="blog introduction", | ||
body='[{"id": "1", "type": "rich_text", "value": "<p>blog body</p>"}]', | ||
) | ||
blogindex.add_child(instance=blog) | ||
|
||
home.button_text = "blog button text" | ||
home.button_link = blog | ||
home.save() | ||
|
||
resp = self.client.get(f"{reverse('search')}?query=introduction") | ||
|
||
self.assertEqual(resp.context["search_query"], "introduction") | ||
self.assertEqual( | ||
list(resp.context["search_results"]), | ||
[Page.objects.get(pk=blog.pk)], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.