Skip to content

Commit

Permalink
Merge pull request #80 from uchicago-library/79-upgrade-django-and-wa…
Browse files Browse the repository at this point in the history
…gtail

Upgrade Django and Wagtail
  • Loading branch information
bbusenius authored Dec 16, 2024
2 parents a243d8e + 03403b4 commit c6fab1a
Show file tree
Hide file tree
Showing 43 changed files with 162 additions and 156 deletions.
23 changes: 20 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Vagrant.configure("2") do |config|
# boxes at https://atlas.hashicorp.com/search.
# https://app.vagrantup.com/ubuntu/boxes/jammy64
config.vm.box = "ubuntu/jammy64"
config.vm.box_version = "20230720.0.0"
config.vm.box_version = "20240720.0.1"

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
Expand Down Expand Up @@ -78,11 +78,21 @@ Vagrant.configure("2") do |config|
chown vagrant /var/log/django-errors.log
chgrp vagrant /var/log/django-errors.log
# Jammy ships wih Python 10. We need Python 11.
# Remove this to go to Python 10 in the future.
echo ""
echo "============== Upgrading to Python 3.11 =============="
apt-get install -y software-properties-common
add-apt-repository ppa:deadsnakes/ppa
apt-get install -y python3.11
apt-get -y install python3.11-distutils
apt-get install -y python3-pip python3.11-dev python3.11-venv
# Install dependencies
echo ""
echo "=========== Installing dependencies ==========="
apt-get update
apt-get install -y postgresql libpq-dev python3-pip python3.10-dev python3.10-distutils python3.10-venv
apt-get install -y postgresql libpq-dev
# Create a Postgres user and database
su - postgres -c "createuser -s vagrant"
Expand All @@ -92,7 +102,7 @@ Vagrant.configure("2") do |config|
echo ""
echo "=========== Creating a Python virtualenv ==========="
echo "..."
cd /home/vagrant && python3 -m venv bmrc
cd /home/vagrant && python3.11 -m venv bmrc
echo ""
echo "============== Installing linting and dev tools =============="
Expand Down Expand Up @@ -121,6 +131,13 @@ Vagrant.configure("2") do |config|
su - vagrant -c "$PYTHON $PROJECT_DIR/manage.py migrate --noinput && \
$PYTHON $PROJECT_DIR/manage.py loaddata /vagrant/home/fixtures/dev.json"
# Fix git permissions
echo ""
echo "============== Fixing git permissions =============="
echo "..."
sudo chown -R vagrant /home/vagrant
# Add some dev sweetness
echo ""
echo "============== Simplicity for developers =============="
Expand Down
7 changes: 1 addition & 6 deletions bmrc/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
'wagtail.search.backends.database',
'wagtail.contrib.redirects',
'wagtail.contrib.settings',
'wagtail.contrib.modeladmin',
'wagtail.embeds',
'wagtail.sites',
'wagtail.users',
Expand All @@ -48,7 +47,7 @@
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'wagtail',
'modelcluster',
'taggit',
'django.contrib.admin',
Expand Down Expand Up @@ -199,8 +198,4 @@

WAGTAIL_SITE_NAME = "bmrc"

# Base URL to use when referring to full URLs within the Wagtail admin backend -
# e.g. in notification emails. Don't include '/admin' or a trailing slash
BASE_URL = 'http://example.com'

TEST_RUNNER = 'portal.tests.NoDbDjangoTestSuiteRunner'
2 changes: 1 addition & 1 deletion bmrc/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.contrib import admin

from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls

from portal import views as portal_views
Expand Down
2 changes: 1 addition & 1 deletion home/fixtures/dev.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions home/migrations/0003_auto_20191018_2051.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import django.db.models.deletion
import modelcluster.fields
import streams.blocks
import wagtail.core.fields
import wagtail.fields


class Migration(migrations.Migration):
Expand All @@ -23,15 +23,15 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='homepage',
name='body',
field=wagtail.core.fields.StreamField([('richtext', streams.blocks.RichtextBlock())], blank=True, null=True),
field=wagtail.fields.StreamField([('richtext', streams.blocks.RichtextBlock())], blank=True, null=True),
),
migrations.CreateModel(
name='HomePageCarouselImages',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('carousel_title', models.CharField(blank=True, max_length=100, null=True)),
('carousel_text', wagtail.core.fields.RichTextField(blank=True, null=True)),
('carousel_text', wagtail.fields.RichTextField(blank=True, null=True)),
('carousel_button', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailcore.Page')),
('carousel_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='carousel_images', to='home.HomePage')),
Expand Down
6 changes: 3 additions & 3 deletions home/migrations/0005_auto_20191022_1953.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from django.db import migrations
import streams.blocks
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.blocks
import wagtail.fields


class Migration(migrations.Migration):
Expand All @@ -21,6 +21,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='homepage',
name='body',
field=wagtail.core.fields.StreamField([('richtext', streams.blocks.RichtextBlock()), ('page_callout', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(help_text='Title for section', required=False)), ('callout_text', streams.blocks.RichtextBlock(features=['bold', 'italic', 'ol', 'ul', 'link', 'document-link'], required=False)), ('button_link', wagtail.core.blocks.PageChooserBlock(required=False)), ('button_label', wagtail.core.blocks.CharBlock(required=False))]))], blank=True, null=True),
field=wagtail.fields.StreamField([('richtext', streams.blocks.RichtextBlock()), ('page_callout', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(help_text='Title for section', required=False)), ('callout_text', streams.blocks.RichtextBlock(features=['bold', 'italic', 'ol', 'ul', 'link', 'document-link'], required=False)), ('button_link', wagtail.blocks.PageChooserBlock(required=False)), ('button_label', wagtail.blocks.CharBlock(required=False))]))], blank=True, null=True),
),
]
6 changes: 3 additions & 3 deletions home/migrations/0006_auto_20191023_2022.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from django.db import migrations
import streams.blocks
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.blocks
import wagtail.fields


class Migration(migrations.Migration):
Expand All @@ -16,6 +16,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='homepage',
name='body',
field=wagtail.core.fields.StreamField([('richtext', streams.blocks.RichtextBlock()), ('page_callout', wagtail.core.blocks.StructBlock([('callout_title', wagtail.core.blocks.CharBlock(help_text='Title for callout section', required=False)), ('callout_text', streams.blocks.RichtextBlock(features=['bold', 'italic', 'ol', 'ul', 'link', 'document-link'], label='Callout Text', required=False)), ('button_link', wagtail.core.blocks.PageChooserBlock(help_text='Where you want the button to go', required=False)), ('button_label', wagtail.core.blocks.CharBlock(help_text='Text that shows up in button', required=False))])), ('webfeed', wagtail.core.blocks.StructBlock([('webfeed_title', wagtail.core.blocks.CharBlock(help_text='Title for callout section', required=False)), ('webfeed_code', wagtail.core.blocks.RawHTMLBlock(required=False))])), ('new_row', wagtail.core.blocks.StructBlock([]))], blank=True, null=True),
field=wagtail.fields.StreamField([('richtext', streams.blocks.RichtextBlock()), ('page_callout', wagtail.blocks.StructBlock([('callout_title', wagtail.blocks.CharBlock(help_text='Title for callout section', required=False)), ('callout_text', streams.blocks.RichtextBlock(features=['bold', 'italic', 'ol', 'ul', 'link', 'document-link'], label='Callout Text', required=False)), ('button_link', wagtail.blocks.PageChooserBlock(help_text='Where you want the button to go', required=False)), ('button_label', wagtail.blocks.CharBlock(help_text='Text that shows up in button', required=False))])), ('webfeed', wagtail.blocks.StructBlock([('webfeed_title', wagtail.blocks.CharBlock(help_text='Title for callout section', required=False)), ('webfeed_code', wagtail.blocks.RawHTMLBlock(required=False))])), ('new_row', wagtail.blocks.StructBlock([]))], blank=True, null=True),
),
]
7 changes: 3 additions & 4 deletions home/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

from modelcluster.fields import ParentalKey

from wagtail.admin.edit_handlers import (
from wagtail.admin.panels import (
FieldPanel,
InlinePanel,
MultiFieldPanel,
PageChooserPanel,
)
from wagtail.core.fields import RichTextField, StreamField
from wagtail.core.models import Page, Orderable
from wagtail.fields import RichTextField, StreamField
from wagtail.models import Page, Orderable

from streams import blocks
from news.models import NewsStoryPage
Expand Down Expand Up @@ -67,7 +67,6 @@ class HomePage(Page):
],
null=True,
blank=True,
use_json_field=True,
)

content_panels = Page.content_panels + [
Expand Down
8 changes: 4 additions & 4 deletions memb_collections/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import django.db.models.deletion
import modelcluster.fields
import streams.blocks
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks


Expand All @@ -22,7 +22,7 @@ class Migration(migrations.Migration):
name='MembCollectionIndexPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.core.fields.StreamField([('richtext', streams.blocks.RichtextBlock()), ('image_block', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('caption', streams.blocks.RichtextBlock(features=['bold', 'italic', 'link'], label='Caption', required=False)), ('alignment', streams.blocks.ImageFormatChoiceBlock(required=False))])), ('new_row', wagtail.core.blocks.StructBlock([])), ('memb_coll_search_block', wagtail.core.blocks.StructBlock([]))], blank=True, null=True)),
('body', wagtail.fields.StreamField([('richtext', streams.blocks.RichtextBlock()), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('caption', streams.blocks.RichtextBlock(features=['bold', 'italic', 'link'], label='Caption', required=False)), ('alignment', streams.blocks.ImageFormatChoiceBlock(required=False))])), ('new_row', wagtail.blocks.StructBlock([])), ('memb_coll_search_block', wagtail.blocks.StructBlock([]))], blank=True, null=True)),
],
options={
'verbose_name': 'Member Collection Index Page',
Expand All @@ -36,7 +36,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('sidebar_title', models.CharField(blank=True, max_length=100, null=True)),
('sidebar_text', wagtail.core.fields.RichTextField(blank=True, null=True)),
('sidebar_text', wagtail.fields.RichTextField(blank=True, null=True)),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='sidebar', to='memb_collections.MembCollectionIndexPage')),
],
options={
Expand Down
6 changes: 3 additions & 3 deletions memb_collections/migrations/0002_auto_20191204_1356.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from django.db import migrations
import streams.blocks
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks


Expand All @@ -17,6 +17,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='membcollectionindexpage',
name='body',
field=wagtail.core.fields.StreamField([('richtext', streams.blocks.RichtextBlock()), ('image_block', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('caption', streams.blocks.RichtextBlock(features=['bold', 'italic', 'link'], label='Caption', required=False)), ('alignment', streams.blocks.ImageFormatChoiceBlock(required=False))])), ('new_row', wagtail.core.blocks.StructBlock([])), ('memb_coll_search_block', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='Optional: Label placed above search box', required=False)), ('search_help_text', wagtail.core.blocks.CharBlock(help_text='Optional: Placed below search box', required=False))]))], blank=True, null=True),
field=wagtail.fields.StreamField([('richtext', streams.blocks.RichtextBlock()), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('caption', streams.blocks.RichtextBlock(features=['bold', 'italic', 'link'], label='Caption', required=False)), ('alignment', streams.blocks.ImageFormatChoiceBlock(required=False))])), ('new_row', wagtail.blocks.StructBlock([])), ('memb_coll_search_block', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='Optional: Label placed above search box', required=False)), ('search_help_text', wagtail.blocks.CharBlock(help_text='Optional: Placed below search box', required=False))]))], blank=True, null=True),
),
]
7 changes: 3 additions & 4 deletions memb_collections/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

from modelcluster.fields import ParentalKey

from wagtail.admin.edit_handlers import (
from wagtail.admin.panels import (
FieldPanel,
InlinePanel,
MultiFieldPanel,
)
from wagtail.core.fields import RichTextField, StreamField
from wagtail.core.models import Page, Orderable
from wagtail.fields import RichTextField, StreamField
from wagtail.models import Page, Orderable
from wagtail.search import index

from streams import blocks
Expand Down Expand Up @@ -56,7 +56,6 @@ class MembCollectionIndexPage(Page):
],
null=True,
blank=True,
use_json_field=True,
)

content_panels = Page.content_panels + [
Expand Down
6 changes: 3 additions & 3 deletions news/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from django.db import migrations, models
import django.db.models.deletion
import streams.blocks
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks


Expand Down Expand Up @@ -33,7 +33,7 @@ class Migration(migrations.Migration):
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('excerpt', models.CharField(blank=True, max_length=300, null=True)),
('body', wagtail.core.fields.StreamField([('richtext', streams.blocks.RichtextBlock()), ('page_callout', wagtail.core.blocks.StructBlock([('callout_title', wagtail.core.blocks.CharBlock(help_text='Title for callout section', required=False)), ('callout_text', streams.blocks.RichtextBlock(features=['bold', 'italic', 'ol', 'ul', 'link', 'document-link'], label='Callout Text', required=False)), ('button_link', wagtail.core.blocks.PageChooserBlock(help_text='Where you want the button to go', required=False)), ('button_label', wagtail.core.blocks.CharBlock(help_text='Text that shows up in button', required=False))])), ('image_block', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('caption', streams.blocks.RichtextBlock(features=['bold', 'italic', 'link'], label='Caption', required=False)), ('alignment', streams.blocks.ImageFormatChoiceBlock(required=False))])), ('new_row', wagtail.core.blocks.StructBlock([]))], blank=True, null=True)),
('body', wagtail.fields.StreamField([('richtext', streams.blocks.RichtextBlock()), ('page_callout', wagtail.blocks.StructBlock([('callout_title', wagtail.blocks.CharBlock(help_text='Title for callout section', required=False)), ('callout_text', streams.blocks.RichtextBlock(features=['bold', 'italic', 'ol', 'ul', 'link', 'document-link'], label='Callout Text', required=False)), ('button_link', wagtail.blocks.PageChooserBlock(help_text='Where you want the button to go', required=False)), ('button_label', wagtail.blocks.CharBlock(help_text='Text that shows up in button', required=False))])), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('caption', streams.blocks.RichtextBlock(features=['bold', 'italic', 'link'], label='Caption', required=False)), ('alignment', streams.blocks.ImageFormatChoiceBlock(required=False))])), ('new_row', wagtail.blocks.StructBlock([]))], blank=True, null=True)),
('lead_image', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image')),
],
options={
Expand Down
4 changes: 2 additions & 2 deletions news/migrations/0005_newssidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
import wagtail.core.fields
import wagtail.fields


class Migration(migrations.Migration):
Expand All @@ -19,7 +19,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('sidebar_title', models.CharField(blank=True, max_length=100, null=True)),
('sidebar_text', wagtail.core.fields.RichTextField(blank=True, null=True)),
('sidebar_text', wagtail.fields.RichTextField(blank=True, null=True)),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='news_sidebar', to='news.NewsIndexPage')),
],
options={
Expand Down
6 changes: 3 additions & 3 deletions news/migrations/0006_newslettersignuppage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from django.db import migrations, models
import django.db.models.deletion
import streams.blocks
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks


Expand All @@ -20,7 +20,7 @@ class Migration(migrations.Migration):
name='NewsletterSignupPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.core.fields.StreamField([('richtext', streams.blocks.RichtextBlock()), ('webfeed', wagtail.core.blocks.StructBlock([('webfeed_title', wagtail.core.blocks.CharBlock(help_text='Title for callout section', required=False)), ('webfeed_code', wagtail.core.blocks.RawHTMLBlock(required=False))])), ('image_block', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('caption', streams.blocks.RichtextBlock(features=['bold', 'italic', 'link'], label='Caption', required=False)), ('alignment', streams.blocks.ImageFormatChoiceBlock(required=False))])), ('new_row', wagtail.core.blocks.StructBlock([]))], blank=True, null=True)),
('body', wagtail.fields.StreamField([('richtext', streams.blocks.RichtextBlock()), ('webfeed', wagtail.blocks.StructBlock([('webfeed_title', wagtail.blocks.CharBlock(help_text='Title for callout section', required=False)), ('webfeed_code', wagtail.blocks.RawHTMLBlock(required=False))])), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('caption', streams.blocks.RichtextBlock(features=['bold', 'italic', 'link'], label='Caption', required=False)), ('alignment', streams.blocks.ImageFormatChoiceBlock(required=False))])), ('new_row', wagtail.blocks.StructBlock([]))], blank=True, null=True)),
],
options={
'verbose_name': 'Newsletter Form',
Expand Down
Loading

0 comments on commit c6fab1a

Please sign in to comment.