Skip to content

Commit

Permalink
Merge pull request #779 from uchicago-library/778-upgrade-django-and-…
Browse files Browse the repository at this point in the history
…wagtail

Upgrade Django and Wagtail
  • Loading branch information
bbusenius authored Dec 15, 2024
2 parents 3986f7c + d90f7c0 commit 5e8adf8
Show file tree
Hide file tree
Showing 65 changed files with 415 additions and 261 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ jobs:
with:
redis-version: 6

- name: Set up Python '3.10'
- name: Set up Python '3.11'
uses: actions/setup-python@v3
with:
python-version: '3.10'
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
15 changes: 9 additions & 6 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) 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"

es = "true"
if ENV['ELASTICSEARCH']
Expand Down Expand Up @@ -191,13 +191,16 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
echo "============== Updating repos =============="
rm -rf /var/lib/apt/lists/partial
apt-get update -y -o Acquire::CompressionTypes::Order::=gz
#apt-get update -y
# Jammy ships wih Python 10. We need Python 11.
# Remove this to go to Python 10 in the future.
echo ""
echo "============== Install Python dev tools =============="
echo "============== Upgrading to Python 3.11 =============="
apt-get install -y software-properties-common
apt-get -y install python3-distutils
apt-get install -y python3-pip python3-dev python3-venv
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 Wagtail dependencies and useful dev tools
echo -e ""
Expand Down Expand Up @@ -258,7 +261,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
echo ""
echo "============== Creating a Python virtualenv =============="
echo "..."
cd /home/vagrant && python3 -m venv lw
cd /home/vagrant && python3.11 -m venv lw
# Pip install project dependencies
echo ""
Expand Down
2 changes: 0 additions & 2 deletions ask_a_librarian/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ class AskPage(PublicBasePage, ContactFields):
],
null=True,
blank=True,
use_json_field=True,
)
ask_widget_name = models.CharField(max_length=100, blank=True)
body = StreamField(
DefaultBodyFields(
null=True,
blank=True,
),
use_json_field=True,
)
reference_resources = RichTextField(
blank=True,
Expand Down
2 changes: 1 addition & 1 deletion base/fixtures/test.json

Large diffs are not rendered by default.

104 changes: 104 additions & 0 deletions base/migrations/0017_alter_localmedia_caption_language.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Generated by Django 5.0.7 on 2024-07-19 20:43

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("base", "0016_alter_intranetindexpage_editor_and_more"),
]

operations = [
migrations.AlterField(
model_name="localmedia",
name="caption_language",
field=models.CharField(
choices=[
("af", "Afrikaans"),
("sq", "Albanian"),
("ar", "Arabic"),
("hy", "Armenian"),
("az", "Azerbaijani"),
("eu", "Basque"),
("be", "Belarusian"),
("bn", "Bengali"),
("bs", "Bosnian"),
("br", "Breton"),
("bg", "Bulgarian"),
("my", "Burmese"),
("ca", "Catalan"),
("hr", "Croatian"),
("cs", "Czech"),
("da", "Danish"),
("nl", "Dutch"),
("en", "English"),
("eo", "Esperanto"),
("et", "Estonian"),
("fi", "Finnish"),
("fr", "French"),
("fy", "Frisian"),
("gl", "Galician"),
("ka", "Georgian"),
("de", "German"),
("el", "Greek"),
("he", "Hebrew"),
("hi", "Hindi"),
("hu", "Hungarian"),
("is", "Icelandic"),
("io", "Ido"),
("ig", "Igbo"),
("id", "Indonesian"),
("ia", "Interlingua"),
("ga", "Irish"),
("it", "Italian"),
("ja", "Japanese"),
("kn", "Kannada"),
("kk", "Kazakh"),
("km", "Khmer"),
("ko", "Korean"),
("ky", "Kyrgyz"),
("lv", "Latvian"),
("lt", "Lithuanian"),
("lb", "Luxembourgish"),
("mk", "Macedonian"),
("ms", "Malay"),
("ml", "Malayalam"),
("mr", "Marathi"),
("mn", "Mongolian"),
("ne", "Nepali"),
("nb", "Norwegian Bokmål"),
("nn", "Norwegian Nynorsk"),
("os", "Ossetic"),
("fa", "Persian"),
("pl", "Polish"),
("pt", "Portuguese"),
("pa", "Punjabi"),
("ro", "Romanian"),
("ru", "Russian"),
("gd", "Scottish Gaelic"),
("sr", "Serbian"),
("sk", "Slovak"),
("sl", "Slovenian"),
("es", "Spanish"),
("sw", "Swahili"),
("sv", "Swedish"),
("tg", "Tajik"),
("ta", "Tamil"),
("tt", "Tatar"),
("te", "Telugu"),
("th", "Thai"),
("tr", "Turkish"),
("tk", "Turkmen"),
("uk", "Ukrainian"),
("ur", "Urdu"),
("ug", "Uyghur"),
("uz", "Uzbek"),
("vi", "Vietnamese"),
("cy", "Welsh"),
],
default="en",
max_length=2,
),
),
]
8 changes: 2 additions & 6 deletions base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1387,8 +1387,8 @@ class BasePageWithoutStaffPageForeignKeys(
Page.search_fields
+ AbstractBaseWithoutStaffPageForeignKeys.search_fields
+ [
index.SearchField('search_description', partial_match=True),
index.SearchField('title', partial_match=True, boost=4),
index.AutocompleteField('search_description'),
index.AutocompleteField('title', boost=4),
]
)

Expand Down Expand Up @@ -1570,7 +1570,6 @@ class PublicBasePage(BasePage):
[
('spreadsheet', LinkQueueSpreadsheetBlock()),
],
use_json_field=True,
default='',
blank=True,
help_text='Spreadsheets should be .xlsx files with the following headers: "Start Date", "End Date", "Link Text", and "URL"',
Expand Down Expand Up @@ -2264,7 +2263,6 @@ def friendly_name(self):
class IntranetPlainPage(BasePage):
body = StreamField(
IntranetDefaultBodyFields(),
use_json_field=True,
)

subpage_types = [
Expand Down Expand Up @@ -2323,12 +2321,10 @@ def get_context(self, request):
class IntranetIndexPage(BasePage):
intro = StreamField(
DefaultBodyFields(),
use_json_field=True,
)
display_hierarchical_listing = models.BooleanField(default=False)
body = StreamField(
DefaultBodyFields(),
use_json_field=True,
)

subpage_types = [
Expand Down
6 changes: 3 additions & 3 deletions base/templates/base/page_owners_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ <h2>Page Owners Report</h2>
<section id="account" class="active nice-padding">
<ul class="fields">
{% block fields %}
{% include "wagtailadmin/shared/field_as_li.html" with field=form.site %}
{% include "wagtailadmin/shared/field_as_li.html" with field=form.cnetid %}
{% include "wagtailadmin/shared/field_as_li.html" with field=form.role %}
<li>{% include "wagtailadmin/shared/field.html" with field=form.site %}</li>
<li>{% include "wagtailadmin/shared/field.html" with field=form.cnetid %}</li>
<li>{% include "wagtailadmin/shared/field.html" with field=form.role %}</li>
{% endblock fields %}
<li><input type="submit" value="{% trans 'Download Report' %}" class="button" /></li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion base/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from public.models import LocationPage, StandardPage
from staff.models import StaffIndexPage, StaffPage
from units.models import UnitPage
from wagtail.core.blocks.stream_block import StreamValue
from wagtail.blocks.stream_block import StreamValue
from wagtail.documents.models import Document
from wagtail.models import Page, Site
from wagtailcache.cache import clear_cache
Expand Down
4 changes: 2 additions & 2 deletions base/wagtail_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def has_permission(user, required_groups):
return user_groups.issuperset(required_groups)


@hooks.register('insert_editor_css')
@hooks.register('insert_global_admin_css')
def editor_css():
"""
Modify the admin css in order to hide
Expand Down Expand Up @@ -140,6 +140,6 @@ def register_frank_menu_item():
return MenuItem(
'Page Owners Report',
reverse('page_owners_report'),
classnames='icon icon-download',
classname='icon icon-download',
order=10009
)
2 changes: 0 additions & 2 deletions conferences/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ class ConferencePage(PublicBasePage, SocialMediaFields):
secondary_registration_description = models.TextField(blank=True)
body = StreamField(
DefaultBodyFields(),
use_json_field=True,
)

# Panels and subpage types
Expand Down Expand Up @@ -280,7 +279,6 @@ class ConferenceSubPage(PublicBasePage):
"""
body = StreamField(
DefaultBodyFields(),
use_json_field=True,
)

content_panels = Page.content_panels + [
Expand Down
1 change: 0 additions & 1 deletion dirbrowse/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class DirBrowsePage(PublicBasePage):
DefaultBodyFields(),
blank=True,
null=True,
use_json_field=True,
)
dir_browse_script_url = CharField(
max_length=255,
Expand Down
3 changes: 2 additions & 1 deletion group/migrations/0011_grouppage_meeting_end_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from __future__ import unicode_literals

from django.db import migrations, models
from django.utils.timezone import utc
import datetime

utc = datetime.timezone.utc


class Migration(migrations.Migration):

Expand Down
3 changes: 2 additions & 1 deletion group/migrations/0012_auto_20151119_2253.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

from django.db import migrations, models
import datetime
from django.utils.timezone import utc

utc = datetime.timezone.utc


class Migration(migrations.Migration):
Expand Down
3 changes: 2 additions & 1 deletion group/migrations/0013_auto_20151120_1921.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

from django.db import migrations, models
import base.models
from django.utils.timezone import utc
import wagtail.blocks
import datetime
import wagtail.images.blocks
import wagtail.fields

utc = datetime.timezone.utc


class Migration(migrations.Migration):

Expand Down
3 changes: 2 additions & 1 deletion group/migrations/0014_auto_20151120_1930.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from __future__ import unicode_literals

from django.db import migrations, models
from django.utils.timezone import utc
import datetime

utc = datetime.timezone.utc


class Migration(migrations.Migration):

Expand Down
3 changes: 2 additions & 1 deletion group/migrations/0015_auto_20151120_1931.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import wagtail.fields
import datetime
import wagtail.images.blocks
from django.utils.timezone import utc

utc = datetime.timezone.utc


class Migration(migrations.Migration):
Expand Down
3 changes: 2 additions & 1 deletion group/migrations/0016_auto_20151120_1957.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

from django.db import migrations, models
import datetime
from django.utils.timezone import utc

utc = datetime.timezone.utc


class Migration(migrations.Migration):
Expand Down
3 changes: 2 additions & 1 deletion group/migrations/0017_auto_20151120_1958.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from __future__ import unicode_literals

from django.db import migrations, models
from django.utils.timezone import utc
import datetime

utc = datetime.timezone.utc


class Migration(migrations.Migration):

Expand Down
3 changes: 2 additions & 1 deletion group/migrations/0018_auto_20151120_2127.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

from django.db import migrations, models
import datetime
from django.utils.timezone import utc

utc = datetime.timezone.utc


class Migration(migrations.Migration):
Expand Down
3 changes: 2 additions & 1 deletion group/migrations/0019_auto_20151120_2136.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from __future__ import unicode_literals

from django.db import migrations, models
from django.utils.timezone import utc
import datetime

utc = datetime.timezone.utc


class Migration(migrations.Migration):

Expand Down
3 changes: 2 additions & 1 deletion group/migrations/0020_auto_20151120_2139.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

from django.db import migrations, models
import datetime
from django.utils.timezone import utc

utc = datetime.timezone.utc


class Migration(migrations.Migration):
Expand Down
3 changes: 2 additions & 1 deletion group/migrations/0021_auto_20151120_2139.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

from django.db import migrations, models
import datetime
from django.utils.timezone import utc

utc = datetime.timezone.utc


class Migration(migrations.Migration):
Expand Down
Loading

0 comments on commit 5e8adf8

Please sign in to comment.