Skip to content

Commit

Permalink
Update Django to 4.2 and related packages for compatibility
Browse files Browse the repository at this point in the history
* We have to declare `max_length` on `Survey.data_type` because of
goinnn/django-multiselectfield#131
* `url` has been removed and replaced by `re_path
* The migration was auto-generated, I'm not completely sure by what.
  • Loading branch information
chigby committed Jan 12, 2024
1 parent d856538 commit baf9016
Show file tree
Hide file tree
Showing 8 changed files with 177 additions and 114 deletions.
45 changes: 45 additions & 0 deletions home/migrations/0065_alter_customrendition_file_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Generated by Django 4.2.9 on 2024-01-12 21:05

import modelcluster.fields
import wagtail.images.models
from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("auth", "0012_alter_user_first_name_max_length"),
("home", "0064_auto_20231208_1551"),
]

operations = [
migrations.AlterField(
model_name="customrendition",
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",
),
),
migrations.AlterField(
model_name="publicationpermissions",
name="groups_with_brief_permission",
field=modelcluster.fields.ParentalManyToManyField(
blank=True,
help_text='Group that has permission to perform the "Publish" action on Brief pages. Only superusers and users that are members of the group selected here may do so, otherwise reports must go through the applicable workflow.',
related_name="+",
to="auth.group",
),
),
migrations.AlterField(
model_name="publicationpermissions",
name="groups_with_report_permission",
field=modelcluster.fields.ParentalManyToManyField(
blank=True,
help_text='Group that has permission to perform the "Publish" action on Report pages. Only superusers and users that are members of the group selected here may do so, otherwise reports must go through the applicable workflow.',
related_name="+",
to="auth.group",
),
),
]
80 changes: 40 additions & 40 deletions newamericadotorg/api/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import url
from django.urls import re_path

import newamericadotorg.api.author.views as author_views
import newamericadotorg.api.event.views as event_views
Expand All @@ -11,47 +11,47 @@
import newamericadotorg.api.search.views as search_views
import newamericadotorg.api.subscribe.views as subscribe_views
import newamericadotorg.api.survey.views as survey_views
import newamericadotorg.api.the_thread.views as thread_views
import newamericadotorg.api.topic.views as topic_views
import newamericadotorg.api.weekly.views as weekly_views
import newamericadotorg.api.the_thread.views as thread_views

api_urls = [
url(r'^post/$', post_views.PostList.as_view(), name='post_list'),
url(r'^search/$', search_views.SearchList.as_view()),
url(r'^search/programs/$', search_views.SearchPrograms.as_view()),
url(r'^search/upcoming_events/$', search_views.SearchUpcomingEvents.as_view()),
url(r'^search/pubs_and_past_events/$', search_views.SearchPublicationsAndPastEvents.as_view()),
url(r'^search/people/$', search_views.SearchPeople.as_view()),
url(r'^search/other/$', search_views.SearchOtherPages.as_view()),
url(r'^event/$', event_views.EventList.as_view()),
#url(r'^api/author/$', cache_page(60 * 10, key_prefix='author_list')(api_views.AuthorList.as_view()), name='author_list'),
url(r'^author/$', author_views.AuthorList.as_view(), name='author_list'),
#url(r'^api/fellow/$', cache_page(60 * 10, key_prefix='fellow_list')(api_views.FellowList.as_view())),
url(r'^fellow/$', author_views.FellowList.as_view()),
#url(r'^api/program/(?P<pk>[\d]+)/$', cache_page(60 * 1440, key_prefix='program_page')(api_views.ProgramDetail.as_view()), name='program'),
url(r'^program/(?P<pk>[\d]+)/featured/$', program_views.ProgramFeaturedPageList.as_view()),
url(r'^program/(?P<pk>[\d]+)/$', program_views.ProgramDetail.as_view()),
#url(r'^api/program/$', cache_page(60 * 1440, key_prefix='program_list')(api_views.ProgramList.as_view()), name='program_list'),
url(r'^program/$', program_views.ProgramList.as_view()),
url(r'^topic/$', topic_views.TopicList.as_view()),
url(r'^topic/(?P<pk>[\d]+)/$', topic_views.TopicDetail.as_view()),
url(r'^subprogram/$', program_views.SubprogramList.as_view()),
#url(r'^api/subprogram/(?P<pk>[\d]+)/$', cache_page(60 * 1440, key_prefix='subprogram_page')(api_views.SubprogramDetail.as_view()), name='subprogram'),
url(r'^subprogram/(?P<pk>[\d]+)/$', program_views.SubprogramDetail.as_view()),
url(r'^weekly/$', weekly_views.WeeklyList.as_view()),
url(r'^weekly/(?P<pk>[\d]+)/$', weekly_views.WeeklyDetail.as_view()),
url(r'^thread/$', thread_views.ThreadList.as_view()),
url(r'^thread/detail/$', thread_views.TopLevelThreadDetail.as_view()),
url(r'^thread/(?P<pk>[\d]+)/$', thread_views.ThreadDetail.as_view()),
url(r'^report/(?P<pk>[\d]+)/$', report_views.ReportDetail.as_view()),
url(r'^preview/$', meta_views.PreviewView.as_view()),
url(r'^home/(?P<pk>[\d]+)/$', home_views.HomeDetail.as_view()),
#url(r'^api/meta/$', cache_page(60 * 10080)(api_views.MetaList.as_view())),
url(r'^meta/$', meta_views.MetaList.as_view()),
#url(r'^api/content-types/$', cache_page(60 * 10080)(api_views.ContentList.as_view())),
url(r'^content-types/$', meta_views.ContentList.as_view()),
url(r'^subscribe/$', subscribe_views.subscribe),
url(r'^jobs/$', jobs_views.JobsList.as_view()),
url(r'^surveys-homepage/(?P<pk>[\d]+)/$', survey_views.SurveyHomeDetail.as_view()),
url(r'^survey/(?P<pk>[\d]+)/$', survey_views.SurveyDetail.as_view())
re_path(r'^post/$', post_views.PostList.as_view(), name='post_list'),
re_path(r'^search/$', search_views.SearchList.as_view()),
re_path(r'^search/programs/$', search_views.SearchPrograms.as_view()),
re_path(r'^search/upcoming_events/$', search_views.SearchUpcomingEvents.as_view()),
re_path(r'^search/pubs_and_past_events/$', search_views.SearchPublicationsAndPastEvents.as_view()),
re_path(r'^search/people/$', search_views.SearchPeople.as_view()),
re_path(r'^search/other/$', search_views.SearchOtherPages.as_view()),
re_path(r'^event/$', event_views.EventList.as_view()),
#re_path(r'^api/author/$', cache_page(60 * 10, key_prefix='author_list')(api_views.AuthorList.as_view()), name='author_list'),
re_path(r'^author/$', author_views.AuthorList.as_view(), name='author_list'),
#re_path(r'^api/fellow/$', cache_page(60 * 10, key_prefix='fellow_list')(api_views.FellowList.as_view())),
re_path(r'^fellow/$', author_views.FellowList.as_view()),
#re_path(r'^api/program/(?P<pk>[\d]+)/$', cache_page(60 * 1440, key_prefix='program_page')(api_views.ProgramDetail.as_view()), name='program'),
re_path(r'^program/(?P<pk>[\d]+)/featured/$', program_views.ProgramFeaturedPageList.as_view()),
re_path(r'^program/(?P<pk>[\d]+)/$', program_views.ProgramDetail.as_view()),
#re_path(r'^api/program/$', cache_page(60 * 1440, key_prefix='program_list')(api_views.ProgramList.as_view()), name='program_list'),
re_path(r'^program/$', program_views.ProgramList.as_view()),
re_path(r'^topic/$', topic_views.TopicList.as_view()),
re_path(r'^topic/(?P<pk>[\d]+)/$', topic_views.TopicDetail.as_view()),
re_path(r'^subprogram/$', program_views.SubprogramList.as_view()),
#re_path(r'^api/subprogram/(?P<pk>[\d]+)/$', cache_page(60 * 1440, key_prefix='subprogram_page')(api_views.SubprogramDetail.as_view()), name='subprogram'),
re_path(r'^subprogram/(?P<pk>[\d]+)/$', program_views.SubprogramDetail.as_view()),
re_path(r'^weekly/$', weekly_views.WeeklyList.as_view()),
re_path(r'^weekly/(?P<pk>[\d]+)/$', weekly_views.WeeklyDetail.as_view()),
re_path(r'^thread/$', thread_views.ThreadList.as_view()),
re_path(r'^thread/detail/$', thread_views.TopLevelThreadDetail.as_view()),
re_path(r'^thread/(?P<pk>[\d]+)/$', thread_views.ThreadDetail.as_view()),
re_path(r'^report/(?P<pk>[\d]+)/$', report_views.ReportDetail.as_view()),
re_path(r'^preview/$', meta_views.PreviewView.as_view()),
re_path(r'^home/(?P<pk>[\d]+)/$', home_views.HomeDetail.as_view()),
#re_path(r'^api/meta/$', cache_page(60 * 10080)(api_views.MetaList.as_view())),
re_path(r'^meta/$', meta_views.MetaList.as_view()),
#re_path(r'^api/content-types/$', cache_page(60 * 10080)(api_views.ContentList.as_view())),
re_path(r'^content-types/$', meta_views.ContentList.as_view()),
re_path(r'^subscribe/$', subscribe_views.subscribe),
re_path(r'^jobs/$', jobs_views.JobsList.as_view()),
re_path(r'^surveys-homepage/(?P<pk>[\d]+)/$', survey_views.SurveyHomeDetail.as_view()),
re_path(r'^survey/(?P<pk>[\d]+)/$', survey_views.SurveyDetail.as_view())
]
60 changes: 30 additions & 30 deletions newamericadotorg/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import include, re_path
from wagtail import urls as wagtail_urls
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.documents import urls as wagtaildocs_urls
Expand All @@ -25,54 +25,54 @@
from search.views import search as search_view

urlpatterns = [
url(r"^django-admin/", admin.site.urls),
url(r"^admin/autocomplete/", include(autocomplete_admin_urls)),
url(r"^admin/", include(wagtailadmin_urls)),
url(r"^documents/", include(wagtaildocs_urls)),
url(r"^images/", include(wagtailimages_urls)),
url(r"^search/$", search_view, name="search"),
url(r"^h_preview/$", newamericadotorg.views.preview, name="headless_preview"),
url(r"^feed/$", GenericFeed()),
url(r"^feed/program/(?P<program>[a-zA-z\-]*)/$", ProgramFeed()),
url(r"^feed/subprogram/(?P<subprogram>[a-zA-z\-]*)/$", SubprogramFeed()),
url(r"^feed/author/(?P<author>[a-zA-z\-]*)/$", AuthorFeed()),
url(r"^feed/event/(?P<tense>future|past)/$", EventFeed()),
url(r"^feed/event/(?P<program>[a-zA-z\-]*)/$", EventProgramFeed()),
url(
re_path(r"^django-admin/", admin.site.urls),
re_path(r"^admin/autocomplete/", include(autocomplete_admin_urls)),
re_path(r"^admin/", include(wagtailadmin_urls)),
re_path(r"^documents/", include(wagtaildocs_urls)),
re_path(r"^images/", include(wagtailimages_urls)),
re_path(r"^search/$", search_view, name="search"),
re_path(r"^h_preview/$", newamericadotorg.views.preview, name="headless_preview"),
re_path(r"^feed/$", GenericFeed()),
re_path(r"^feed/program/(?P<program>[a-zA-z\-]*)/$", ProgramFeed()),
re_path(r"^feed/subprogram/(?P<subprogram>[a-zA-z\-]*)/$", SubprogramFeed()),
re_path(r"^feed/author/(?P<author>[a-zA-z\-]*)/$", AuthorFeed()),
re_path(r"^feed/event/(?P<tense>future|past)/$", EventFeed()),
re_path(r"^feed/event/(?P<program>[a-zA-z\-]*)/$", EventProgramFeed()),
re_path(
r"^feed/event/(?P<program>[a-zA-z\-]*)/(?P<tense>future|past)/$",
EventProgramFeed(),
),
url(r"^feed/(?P<content_type>[a-zA-z]*)/$", ContentFeed()),
url(r"^feed/(?P<content_type>[a-zA-z]*)/(?P<program>[a-zA-z\-]*)/$", ContentFeed()),
url(r"^api/", include(api_urls)),
url(
re_path(r"^feed/(?P<content_type>[a-zA-z]*)/$", ContentFeed()),
re_path(r"^feed/(?P<content_type>[a-zA-z]*)/(?P<program>[a-zA-z\-]*)/$", ContentFeed()),
re_path(r"^api/", include(api_urls)),
re_path(
r"^images/([^/]*)/(\d*)/([^/]*)/[^/]*$",
ServeView.as_view(action="redirect"),
name="wagtailimages_serve",
),
url(
re_path(
r"^international-security/future-property-rights/[^.]*$",
redirects.future_property_rights,
),
url(
re_path(
r"^international-security/planetary-politics/[^.]*$",
redirects.planetary_politics,
),
url(r"^international-security/[^.]*$", redirects.future_security),
url(
re_path(r"^international-security/[^.]*$", redirects.future_security),
re_path(
r"^education-policy/dual-language-learners/[^.]*$",
redirects.dual_language_learners,
),
url(r"^bretton-woods-ii/[^.]*$", redirects.digi),
url(r"^digital-impact-governance-inititiative/[^.]*$", redirects.digi),
url(r"^national-network/[^.]*$", redirects.local),
url(
re_path(r"^bretton-woods-ii/[^.]*$", redirects.digi),
re_path(r"^digital-impact-governance-inititiative/[^.]*$", redirects.digi),
re_path(r"^national-network/[^.]*$", redirects.local),
re_path(
r"^public-interest-technology/new-practice-lab/[^.]*$",
redirects.new_practice_lab,
),
url(r"^public-interest-technology/[^.]*$", redirects.pit),
url(r"^future-property-rights/[^.]*$", redirects.flh),
url(r"", include(wagtail_urls)),
re_path(r"^public-interest-technology/[^.]*$", redirects.pit),
re_path(r"^future-property-rights/[^.]*$", redirects.flh),
re_path(r"", include(wagtail_urls)),
]

if settings.DEBUG:
Expand Down
18 changes: 9 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ classifiers = ["Private :: Do Not Upload"]
version = "0"
dependencies = [
# Django related
'Django >= 3.2.6, < 4',
'Django >= 4.2.9, < 5',
'Wagtail >= 5.2.2, < 5.3',
'Celery >= 4.4, < 5.0',
'dj-database-url >= 1.3.0, < 2',
'django-cors-headers >= 3.13.0, < 4',
'django-storages >= 1.13, < 2',
'django-compressor >= 3.0',
'django-anymail >= 9.0, < 10',
'django-cors-headers >= 4.3.1, < 5',
'django-storages >= 1.14.2, < 2',
'django-compressor >= 4.4',
'django-anymail >= 10.2, < 11',
'django-filter',
'django-modelcluster',
'whitenoise >= 6.4, <7',
'django-redis >= 5.2, <6',
'django-modelcluster >= 6.2.1',
'whitenoise >= 6.6.0, <7',
'django-redis >= 5.4, <6',
'django-basic-auth-ip-whitelist >= 0.5',
'django-csp >= 3.7, <4',

Expand All @@ -33,7 +33,7 @@ dependencies = [
'elasticsearch >= 5.5, <6',
'redis >= 3.4.1, < 4',
# See https://github.com/wagtail/wagtail-autocomplete
'wagtail-autocomplete >= 0.10.0',
'wagtail-autocomplete >= 0.11.0',
# See https://pypi.org/project/django-multiselectfield/
'django-multiselectfield >= 0.1.12',
'gunicorn == 20.0.4',
Expand Down
27 changes: 16 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ amqp==2.6.1
anyascii==0.3.2
# via wagtail
asgiref==3.6.0
# via django
# via
# django
# django-cors-headers
beautifulsoup4==4.9.3
# via wagtail
billiard==3.6.4.0
Expand All @@ -29,11 +31,14 @@ certifi==2022.12.7
cffi==1.15.1
# via
# cairocffi
# cryptography
# weasyprint
charset-normalizer==3.1.0
# via requests
createsend==7.0.0
# via newamerica-cms (pyproject.toml)
cryptography==41.0.7
# via django-anymail
cssselect2==0.7.0
# via
# cairosvg
Expand All @@ -44,7 +49,7 @@ defusedxml==0.7.1
# willow
dj-database-url==1.3.0
# via newamerica-cms (pyproject.toml)
django==3.2.18
django==4.2.9
# via
# dj-database-url
# django-anymail
Expand All @@ -63,33 +68,33 @@ django==3.2.18
# djangorestframework
# newamerica-cms (pyproject.toml)
# wagtail
django-anymail==9.1
django-anymail==10.2
# via newamerica-cms (pyproject.toml)
django-appconf==1.0.5
# via django-compressor
django-basic-auth-ip-whitelist==0.5
# via newamerica-cms (pyproject.toml)
django-compressor==4.3.1
django-compressor==4.4
# via newamerica-cms (pyproject.toml)
django-cors-headers==3.14.0
django-cors-headers==4.3.1
# via newamerica-cms (pyproject.toml)
django-csp==3.7
# via newamerica-cms (pyproject.toml)
django-filter==23.5
# via
# newamerica-cms (pyproject.toml)
# wagtail
django-modelcluster==6.1
django-modelcluster==6.2.1
# via
# newamerica-cms (pyproject.toml)
# wagtail
django-multiselectfield==0.1.12
# via newamerica-cms (pyproject.toml)
django-permissionedforms==0.1
# via wagtail
django-redis==5.2.0
django-redis==5.4.0
# via newamerica-cms (pyproject.toml)
django-storages==1.13.2
django-storages==1.14.2
# via newamerica-cms (pyproject.toml)
django-taggit==2.1.0
# via wagtail
Expand Down Expand Up @@ -145,7 +150,6 @@ python-docx==0.8.11
pytz==2023.3
# via
# celery
# django
# django-modelcluster
# djangorestframework
# l18n
Expand Down Expand Up @@ -187,6 +191,7 @@ typing-extensions==4.5.0
urllib3==1.26.15
# via
# botocore
# django-anymail
# elasticsearch
# requests
# sentry-sdk
Expand All @@ -199,7 +204,7 @@ wagtail==5.2.2
# newamerica-cms (pyproject.toml)
# wagtail-autocomplete
# wagtail-headless-preview
wagtail-autocomplete==0.10.0
wagtail-autocomplete==0.11.0
# via newamerica-cms (pyproject.toml)
wagtail-headless-preview==0.7.0
# via newamerica-cms (pyproject.toml)
Expand All @@ -212,7 +217,7 @@ webencodings==0.5.1
# cssselect2
# html5lib
# tinycss2
whitenoise==6.4.0
whitenoise==6.6.0
# via newamerica-cms (pyproject.toml)
willow[heif]==1.6.2
# via wagtail
Expand Down
Loading

0 comments on commit baf9016

Please sign in to comment.