Skip to content

Commit

Permalink
Django upgrade to 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rafa-garcia committed Jan 2, 2024
1 parent c9a3708 commit 2b2a74d
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 134 deletions.
34 changes: 2 additions & 32 deletions core/wagtail_hooks.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from wagtail.admin.widgets import Button, PageListingButton
from wagtail.admin.widgets import Button
from wagtail import hooks
from wagtail.admin.wagtail_hooks import page_listing_buttons

from django.conf import settings
from django.templatetags.static import static
from django.urls import reverse
from django.utils.html import format_html
from core import helpers, models
from core import models


@hooks.register('register_page_listing_more_buttons')
Expand All @@ -26,35 +25,6 @@ def add_copy_button(page, page_perms, next_url=None, is_parent=False):
)


@helpers.replace_hook('register_page_listing_buttons', page_listing_buttons)
def update_default_listing_buttons(page, page_perms, next_url=None, button_url_name=None):
buttons = list(page_listing_buttons(page, page_perms, next_url))
if isinstance(page, models.BasePage):
for button in buttons:
if (button_url_name and button_url_name == 'view_draft') or \
helpers.get_button_url_name(button) == 'view_draft':
button.url = page.get_url(is_draft=True)

else:
# limit buttons for non-subclasses-of-BasePage
allowed_urls = ['add_subpage']
buttons = [
button for button in buttons
if helpers.get_button_url_name(button) in allowed_urls
]
# since the drop-down is removed by the above, add a delete
# button to this list
if page_perms.can_delete():
buttons.append(PageListingButton(
'Delete',
reverse('wagtailadmin_pages:delete', args=[page.id]),
attrs={
'title': "Delete '%s'" % page.get_admin_display_title()
},
))
return buttons


@hooks.register('insert_editor_css')
def editor_css():
return format_html(
Expand Down
14 changes: 7 additions & 7 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
django==4.1.13
django==4.2.3
djangorestframework==3.14.*
django-environ==0.*
gunicorn==20.*
Expand All @@ -10,10 +10,10 @@ psycopg2==2.9.* --no-binary psycopg2
django-pglocks==1.0.*
boto3==1.24.*
sigauth==5.2.2
directory-healthcheck==3.*
directory-components==39.*
directory-constants==23.*
django-staff-sso-client==4.*
directory-healthcheck==3.2
directory-components==40.*
directory-constants==24.*
django-staff-sso-client==4.2.1
html2text==2020.*
pytube==9.2.2
django-filter>=2.4.0
Expand All @@ -25,9 +25,9 @@ requests[security]>=2.31.0
markdown==3.*
bleach==3.*
bleach-whitelist==0.*
wagtail==4.1.9
wagtail==5.2.2
wagtail-markdown==0.11
wagtail-modeltranslation==0.13.*
wagtail-modeltranslation==0.14.*
django-modeltranslation==0.18.*
urllib3==1.26.*
w3lib==1.22
Expand Down
38 changes: 22 additions & 16 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ cryptography==41.0.7
# via -r requirements.in
defusedxml==0.7.1
# via willow
directory-components==39.1.4
directory-components==40.0.0
# via -r requirements.in
directory-constants==23.1.1
directory-constants==24.0.0
# via
# -r requirements.in
# directory-components
directory-healthcheck==3.1.2
directory-healthcheck==3.2
# via -r requirements.in
dj-database-url==2.1.0
# via -r requirements.in
django==4.1.13
django==4.2.3
# via
# -r requirements.in
# directory-components
Expand Down Expand Up @@ -105,7 +105,7 @@ django-celery-beat==2.5.0
# via -r requirements.in
django-environ==0.11.2
# via -r requirements.in
django-filter==22.1
django-filter==23.5
# via
# -r requirements.in
# wagtail
Expand All @@ -127,7 +127,7 @@ django-staff-sso-client==4.2.1
# via -r requirements.in
django-storages==1.13.2
# via -r requirements.in
django-taggit==3.1.0
django-taggit==4.0.0
# via wagtail
django-timezone-field==6.1.0
# via django-celery-beat
Expand All @@ -145,7 +145,7 @@ docopt==0.6.2
# num2words
draftjs-exporter==2.1.7
# via wagtail
drf-spectacular==0.26.5
drf-spectacular==0.27.0
# via -r requirements.in
ecs-logging==2.1.0
# via elastic-apm
Expand All @@ -157,7 +157,7 @@ filetype==1.2.0
# via willow
gevent==23.9.1
# via -r requirements.in
greenlet==3.0.1
greenlet==3.0.2
# via gevent
gunicorn==20.1.0
# via -r requirements.in
Expand All @@ -167,7 +167,7 @@ html5lib==1.1
# via wagtail
idna==3.6
# via requests
importlib-metadata==6.8.0
importlib-metadata==7.0.0
# via markdown
inflection==0.5.1
# via drf-spectacular
Expand Down Expand Up @@ -204,8 +204,12 @@ openpyxl==3.1.2
packaging==23.2
# via bleach
pillow==10.1.0
# via wagtail
prompt-toolkit==3.0.41
# via
# pillow-heif
# wagtail
pillow-heif==0.14.0
# via willow
prompt-toolkit==3.0.43
# via click-repl
psycogreen==1.0.2
# via -r requirements.in
Expand Down Expand Up @@ -243,13 +247,14 @@ requests[security]==2.31.0
# via
# -r requirements.in
# notifications-python-client
# requests
# requests-oauthlib
# wagtail
requests-oauthlib==1.3.1
# via django-staff-sso-client
s3transfer==0.6.2
# via boto3
sentry-sdk==1.38.0
sentry-sdk==1.39.1
# via -r requirements.in
sigauth==5.2.2
# via -r requirements.in
Expand All @@ -269,11 +274,12 @@ sqlparse==0.4.4
# via django
telepath==0.3.1
# via wagtail
typing-extensions==4.8.0
typing-extensions==4.9.0
# via
# asgiref
# dj-database-url
# django-modeltranslation
# drf-spectacular
# kombu
tzdata==2023.3
# via
Expand All @@ -295,15 +301,15 @@ vine==5.1.0
# kombu
w3lib==1.22.0
# via -r requirements.in
wagtail==4.1.9
wagtail==5.2.2
# via
# -r requirements.in
# wagtail-markdown
# wagtail-modeltranslation
# wagtailmedia
wagtail-markdown==0.11.0
# via -r requirements.in
wagtail-modeltranslation==0.13.0
wagtail-modeltranslation==0.14.1
# via -r requirements.in
wagtailmedia==0.14.5
# via -r requirements.in
Expand All @@ -315,7 +321,7 @@ webencodings==0.5.1
# html5lib
whitenoise==6.4.0
# via -r requirements.in
willow==1.6.3
willow[heif]==1.6.3
# via
# -r requirements.in
# wagtail
Expand Down
4 changes: 2 additions & 2 deletions requirements_test.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ flake8==6.1.0
requests_mock
freezegun==0.3.14
coveralls
factory-boy==2.*
wagtail-factories==2.0.1
factory-boy==3.3.0
wagtail-factories==4.1.0
django-debug-toolbar==3.2.*
pip-tools
pytest-codecov
Expand Down
Loading

0 comments on commit 2b2a74d

Please sign in to comment.