From c6f1601666cccc780b58f8ad60669f0a1e02b7ec Mon Sep 17 00:00:00 2001 From: Ian Stride Date: Wed, 13 Mar 2024 09:24:16 +0000 Subject: [PATCH] Upgrade to Wagtail 2.16.3 (#1669) --- home/templatetags/generic_components.py | 5 --- home/wagtail_hooks.py | 41 +++++++++++++++---- iogt/settings/production.py | 2 +- .../shared/menu_settings_menu_item.html | 8 ---- requirements.dev.txt | 12 +++--- requirements.in | 2 +- requirements.txt | 12 +++--- 7 files changed, 46 insertions(+), 36 deletions(-) delete mode 100644 iogt/templates/wagtailadmin/shared/menu_settings_menu_item.html diff --git a/home/templatetags/generic_components.py b/home/templatetags/generic_components.py index 02258816a..7f261ff33 100644 --- a/home/templatetags/generic_components.py +++ b/home/templatetags/generic_components.py @@ -85,11 +85,6 @@ def language_picker_style(): f"{theme_settings.language_picker_background_color}" -@register.simple_tag -def site_version(): - return settings.SITE_VERSION - - @register.simple_tag(takes_context=True) def google_analytics(context, tracking_code=None, debug=False): if not tracking_code: diff --git a/home/wagtail_hooks.py b/home/wagtail_hooks.py index eef951169..e20089b61 100644 --- a/home/wagtail_hooks.py +++ b/home/wagtail_hooks.py @@ -1,23 +1,25 @@ from urllib.parse import urlparse +from django.conf import settings from django.contrib.admin import SimpleListFilter from django.core.exceptions import PermissionDenied from django.db.models import Q +from django.templatetags.static import static from django.urls import resolve +from django.utils.html import format_html from django.utils.translation import gettext_lazy as _ -from translation_manager.models import TranslationEntry +from wagtail import __version__ +from wagtail.admin import widgets as wagtailadmin_widgets +from wagtail.admin.menu import MenuItem, SubmenuMenuItem +from wagtail.contrib.modeladmin.menus import SubMenu from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register -from django.templatetags.static import static -from django.utils.html import format_html from wagtail.core import hooks -from wagtail.core.models import Page -from wagtail.core.models import PageViewRestriction -from wagtail.admin import widgets as wagtailadmin_widgets +from wagtail.core.models import Page, PageViewRestriction - -from home.models import FooterIndexPage, BannerIndexPage, Section, \ - SectionIndexPage, LocaleDetail +from home.models import (BannerIndexPage, FooterIndexPage, LocaleDetail, + Section, SectionIndexPage) from home.translatable_strings import translatable_strings +from translation_manager.models import TranslationEntry @hooks.register('before_serve_page', order=-1) @@ -103,6 +105,27 @@ def page_listing_buttons(page, page_perms, is_parent=False, next_url=None): ) +@hooks.register("register_admin_menu_item") +def about(): + items = [ + MenuItem( + label=f"IoGT {settings.SITE_VERSION}", + url=f"http://github.com/unicef/iogt/releases/tag/{settings.SITE_VERSION}", + ), + MenuItem( + label=f"Wagtail {__version__}", + url=f"http://github.com/wagtail/wagtail/releases/tag/v{__version__}" + ) + ] + + return SubmenuMenuItem( + label="About", + menu=SubMenu(items), + icon_name="info-circle", + order=999999, + ) + + class LimitedTranslatableStringsFilter(SimpleListFilter): title = _('limited translatable strings') parameter_name = 'limited' diff --git a/iogt/settings/production.py b/iogt/settings/production.py index ef9b114fe..3d3f078b2 100644 --- a/iogt/settings/production.py +++ b/iogt/settings/production.py @@ -41,7 +41,7 @@ }, } -SITE_VERSION = '2.7.2' +SITE_VERSION = '2.8.0-rc.2' try: from .local import * diff --git a/iogt/templates/wagtailadmin/shared/menu_settings_menu_item.html b/iogt/templates/wagtailadmin/shared/menu_settings_menu_item.html deleted file mode 100644 index a6b1ef98a..000000000 --- a/iogt/templates/wagtailadmin/shared/menu_settings_menu_item.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "wagtailadmin/shared/menu_submenu_item.html" %} -{% load generic_components %} -{% load wagtailcore_tags %} - -{% block menu_footer %} - - -{% endblock %} diff --git a/requirements.dev.txt b/requirements.dev.txt index 3b5529d43..b3c32d4f5 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -452,9 +452,9 @@ django-sass-processor==1.0.1 \ --hash=sha256:1f043180c47754018e803a77da003377f5ea6558de57cd6946eb27a32e9c16a2 \ --hash=sha256:dcaad47c591a2d52689c1bd209259e922e902d886293f0d5c9e0d1a4eb85eda2 # via -r requirements.txt -django-taggit==1.5.1 \ - --hash=sha256:dfe9e9c10b5929132041de0c00093ef0072c73c2a97d0f74a818ae50fa77149a \ - --hash=sha256:e5bb62891f458d55332e36a32e19c08d20142c43f74bc5656c803f8af25c084a +django-taggit==2.1.0 \ + --hash=sha256:61547a23fc99967c9304107414a09e662b459f4163dbbae32e60b8ba40c34d05 \ + --hash=sha256:a9f41e4ad58efe4b28d86f274728ee87eb98eeae90c9eb4b4efad39e5068184e # via # -r requirements.txt # wagtail @@ -1093,9 +1093,9 @@ vine==5.1.0 \ # amqp # celery # kombu -wagtail==2.15.6 \ - --hash=sha256:7334197ff04f9bfe1eeae2038365ea957a691644cd3464ab07b117c81bc83a1e \ - --hash=sha256:bf334b5aa521beca230b3d426f5abc19e7f8df88492b07c1e2ca90e267c6e28f +wagtail==2.16.3 \ + --hash=sha256:3b52f0e1a4bcad66e57eaa341025e90a6dcd40170f7adb132e9e9df9efa978c9 \ + --hash=sha256:a1f04513f06c760208698578367f03b3af5400f05d36b94e4a8ce07ee30d42fc # via # -r requirements.txt # wagtail-cache diff --git a/requirements.in b/requirements.in index eb4540d86..cf291c22b 100644 --- a/requirements.in +++ b/requirements.in @@ -30,7 +30,7 @@ tqdm==4.62.* wagtail-cache~=1.2.1 wagtail-localize==1.3.3 wagtail-markdown==0.7.0 -wagtail==2.15.* +wagtail~=2.16.3 wagtailmedia==0.10.* wagtailmenus==3.1.3 wagtailsvg==0.0.14 diff --git a/requirements.txt b/requirements.txt index a98f4a6bf..52a729ed8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -354,9 +354,9 @@ django-sass-processor==1.0.1 \ --hash=sha256:1f043180c47754018e803a77da003377f5ea6558de57cd6946eb27a32e9c16a2 \ --hash=sha256:dcaad47c591a2d52689c1bd209259e922e902d886293f0d5c9e0d1a4eb85eda2 # via -r requirements.in -django-taggit==1.5.1 \ - --hash=sha256:dfe9e9c10b5929132041de0c00093ef0072c73c2a97d0f74a818ae50fa77149a \ - --hash=sha256:e5bb62891f458d55332e36a32e19c08d20142c43f74bc5656c803f8af25c084a +django-taggit==2.1.0 \ + --hash=sha256:61547a23fc99967c9304107414a09e662b459f4163dbbae32e60b8ba40c34d05 \ + --hash=sha256:a9f41e4ad58efe4b28d86f274728ee87eb98eeae90c9eb4b4efad39e5068184e # via wagtail django-translation-manager==1.3.0 \ --hash=sha256:1e3143f48f9ba4d5452d72f55195142c434ea63786546251ae694508df4eb7b1 \ @@ -850,9 +850,9 @@ vine==5.1.0 \ # amqp # celery # kombu -wagtail==2.15.6 \ - --hash=sha256:7334197ff04f9bfe1eeae2038365ea957a691644cd3464ab07b117c81bc83a1e \ - --hash=sha256:bf334b5aa521beca230b3d426f5abc19e7f8df88492b07c1e2ca90e267c6e28f +wagtail==2.16.3 \ + --hash=sha256:3b52f0e1a4bcad66e57eaa341025e90a6dcd40170f7adb132e9e9df9efa978c9 \ + --hash=sha256:a1f04513f06c760208698578367f03b3af5400f05d36b94e4a8ce07ee30d42fc # via # -r requirements.in # wagtail-cache