From 8839ec5b5d30ed9b2b0dc485485c355b61fd2cbf Mon Sep 17 00:00:00 2001 From: sandeepsajan0 Date: Mon, 27 Jan 2025 11:57:20 +0530 Subject: [PATCH] Use wagtail_modeladmin as separate package --- hypha/apply/categories/admin.py | 2 +- hypha/apply/categories/admin_helpers.py | 2 +- hypha/apply/categories/admin_views.py | 2 +- hypha/apply/determinations/admin.py | 4 ++-- hypha/apply/determinations/admin_views.py | 2 +- hypha/apply/funds/admin.py | 4 ++-- hypha/apply/funds/admin_helpers.py | 8 +++---- hypha/apply/funds/admin_views.py | 2 +- hypha/apply/funds/wagtail_hooks.py | 2 +- hypha/apply/projects/admin.py | 2 +- hypha/apply/projects/admin_views.py | 2 +- hypha/apply/projects/wagtail_hooks.py | 2 +- hypha/apply/review/admin.py | 4 ++-- hypha/apply/review/admin_helpers.py | 2 +- hypha/apply/review/admin_views.py | 2 +- hypha/core/wagtail/admin/options.py | 4 ++-- hypha/settings/django.py | 2 +- pyproject.toml | 1 + requirements/dev.txt | 3 +++ requirements/prod.txt | 3 +++ uv.lock | 26 +++++++++++++++++------ 21 files changed, 51 insertions(+), 30 deletions(-) diff --git a/hypha/apply/categories/admin.py b/hypha/apply/categories/admin.py index e4f5f41927..da1d2821f1 100644 --- a/hypha/apply/categories/admin.py +++ b/hypha/apply/categories/admin.py @@ -1,5 +1,5 @@ from django.urls import re_path -from wagtail.contrib.modeladmin.options import ModelAdmin +from wagtail_modeladmin.options import ModelAdmin from hypha.apply.utils.admin import AdminIcon diff --git a/hypha/apply/categories/admin_helpers.py b/hypha/apply/categories/admin_helpers.py index a6c9b78f06..90310a4b30 100644 --- a/hypha/apply/categories/admin_helpers.py +++ b/hypha/apply/categories/admin_helpers.py @@ -1,5 +1,5 @@ from django.contrib.admin.utils import quote -from wagtail.contrib.modeladmin.helpers import ButtonHelper +from wagtail_modeladmin.helpers import ButtonHelper class MetaTermButtonHelper(ButtonHelper): diff --git a/hypha/apply/categories/admin_views.py b/hypha/apply/categories/admin_views.py index 2a4e9d3926..e0192e7a70 100644 --- a/hypha/apply/categories/admin_views.py +++ b/hypha/apply/categories/admin_views.py @@ -1,6 +1,6 @@ from django.contrib.admin.utils import unquote from django.shortcuts import get_object_or_404 -from wagtail.contrib.modeladmin.views import CreateView +from wagtail_modeladmin.views import CreateView class AddChildMetaTermViewClass(CreateView): diff --git a/hypha/apply/determinations/admin.py b/hypha/apply/determinations/admin.py index 5d78278249..1775162273 100644 --- a/hypha/apply/determinations/admin.py +++ b/hypha/apply/determinations/admin.py @@ -1,6 +1,6 @@ from django.urls import re_path -from wagtail.contrib.modeladmin.options import ModelAdmin -from wagtail.contrib.modeladmin.views import CreateView, InstanceSpecificView +from wagtail_modeladmin.options import ModelAdmin +from wagtail_modeladmin.views import CreateView, InstanceSpecificView from hypha.apply.determinations.models import ( DeterminationForm, diff --git a/hypha/apply/determinations/admin_views.py b/hypha/apply/determinations/admin_views.py index a363b49365..707c476490 100644 --- a/hypha/apply/determinations/admin_views.py +++ b/hypha/apply/determinations/admin_views.py @@ -1,4 +1,4 @@ -from wagtail.contrib.modeladmin.views import CreateView, EditView +from wagtail_modeladmin.views import CreateView, EditView from hypha.apply.utils.blocks import show_admin_form_error_messages diff --git a/hypha/apply/funds/admin.py b/hypha/apply/funds/admin.py index 30bdfa3706..9ee1880437 100644 --- a/hypha/apply/funds/admin.py +++ b/hypha/apply/funds/admin.py @@ -1,7 +1,7 @@ from django.urls import re_path from django.utils.safestring import mark_safe -from wagtail.contrib.modeladmin.helpers import PermissionHelper -from wagtail.contrib.modeladmin.options import ModelAdmin, ModelAdminGroup +from wagtail_modeladmin.helpers import PermissionHelper +from wagtail_modeladmin.options import ModelAdmin, ModelAdminGroup from hypha.apply.categories.admin import CategoryAdmin, MetaTermAdmin from hypha.apply.determinations.admin import ( diff --git a/hypha/apply/funds/admin_helpers.py b/hypha/apply/funds/admin_helpers.py index 1e00c06b4b..77da19afcb 100644 --- a/hypha/apply/funds/admin_helpers.py +++ b/hypha/apply/funds/admin_helpers.py @@ -5,14 +5,14 @@ from django.urls import reverse from django.utils.functional import cached_property from django.utils.translation import gettext_lazy as _ -from wagtail.contrib.modeladmin.forms import ParentChooserForm -from wagtail.contrib.modeladmin.helpers import ( +from wagtail.models import Page +from wagtail_modeladmin.forms import ParentChooserForm +from wagtail_modeladmin.helpers import ( ButtonHelper, PageAdminURLHelper, PageButtonHelper, ) -from wagtail.contrib.modeladmin.views import ChooseParentView -from wagtail.models import Page +from wagtail_modeladmin.views import ChooseParentView class VerboseLabelModelChoiceField(forms.ModelChoiceField): diff --git a/hypha/apply/funds/admin_views.py b/hypha/apply/funds/admin_views.py index bac9654ac2..c110f7aae8 100644 --- a/hypha/apply/funds/admin_views.py +++ b/hypha/apply/funds/admin_views.py @@ -6,8 +6,8 @@ from wagtail.admin import messages from wagtail.admin.forms.pages import CopyForm from wagtail.admin.views.pages.utils import get_valid_next_url_from_request -from wagtail.contrib.modeladmin.views import CreateView, EditView from wagtail.models import Page +from wagtail_modeladmin.views import CreateView, EditView from hypha.apply.funds.utils import get_copied_form_name from hypha.apply.utils.blocks import show_admin_form_error_messages diff --git a/hypha/apply/funds/wagtail_hooks.py b/hypha/apply/funds/wagtail_hooks.py index 3dbbafdc6f..65df5e06ff 100644 --- a/hypha/apply/funds/wagtail_hooks.py +++ b/hypha/apply/funds/wagtail_hooks.py @@ -1,6 +1,6 @@ from django.contrib.auth.models import Permission from wagtail import hooks -from wagtail.contrib.modeladmin.options import modeladmin_register +from wagtail_modeladmin.options import modeladmin_register from .admin import ApplyAdminGroup from .admin_views import custom_admin_round_copy_view diff --git a/hypha/apply/projects/admin.py b/hypha/apply/projects/admin.py index 9d2f2def9b..075d2cf8df 100644 --- a/hypha/apply/projects/admin.py +++ b/hypha/apply/projects/admin.py @@ -1,4 +1,4 @@ -from wagtail.contrib.modeladmin.options import ModelAdmin, ModelAdminGroup +from wagtail_modeladmin.options import ModelAdmin, ModelAdminGroup from hypha.apply.utils.admin import AdminIcon, ListRelatedMixin from hypha.core.wagtail.admin import SettingModelAdmin diff --git a/hypha/apply/projects/admin_views.py b/hypha/apply/projects/admin_views.py index 675dd79e86..d896fdbb25 100644 --- a/hypha/apply/projects/admin_views.py +++ b/hypha/apply/projects/admin_views.py @@ -1,4 +1,4 @@ -from wagtail.contrib.modeladmin.views import CreateView, EditView +from wagtail_modeladmin.views import CreateView, EditView from hypha.apply.utils.blocks import show_admin_form_error_messages diff --git a/hypha/apply/projects/wagtail_hooks.py b/hypha/apply/projects/wagtail_hooks.py index e71aaa7933..90ed9b3c3c 100644 --- a/hypha/apply/projects/wagtail_hooks.py +++ b/hypha/apply/projects/wagtail_hooks.py @@ -1,6 +1,6 @@ from django.conf import settings -from wagtail.contrib.modeladmin.options import modeladmin_register from wagtail.contrib.settings.registry import register_setting +from wagtail_modeladmin.options import modeladmin_register from .admin import ProjectAdminGroup from .models import ProjectSettings diff --git a/hypha/apply/review/admin.py b/hypha/apply/review/admin.py index c55f1b1eb2..b23d99d019 100644 --- a/hypha/apply/review/admin.py +++ b/hypha/apply/review/admin.py @@ -1,6 +1,6 @@ from django.urls import re_path -from wagtail.contrib.modeladmin.options import ModelAdmin -from wagtail.contrib.modeladmin.views import CreateView, InstanceSpecificView +from wagtail_modeladmin.options import ModelAdmin +from wagtail_modeladmin.views import CreateView, InstanceSpecificView from hypha.apply.review.models import ReviewForm from hypha.apply.utils.admin import AdminIcon, ListRelatedMixin diff --git a/hypha/apply/review/admin_helpers.py b/hypha/apply/review/admin_helpers.py index 750d24735e..74942f5735 100644 --- a/hypha/apply/review/admin_helpers.py +++ b/hypha/apply/review/admin_helpers.py @@ -1,4 +1,4 @@ -from wagtail.contrib.modeladmin.helpers import PageButtonHelper +from wagtail_modeladmin.helpers import PageButtonHelper class ButtonsWithClone(PageButtonHelper): diff --git a/hypha/apply/review/admin_views.py b/hypha/apply/review/admin_views.py index 35553c2523..cde21bd9c6 100644 --- a/hypha/apply/review/admin_views.py +++ b/hypha/apply/review/admin_views.py @@ -1,4 +1,4 @@ -from wagtail.contrib.modeladmin.views import CreateView, EditView +from wagtail_modeladmin.views import CreateView, EditView from hypha.apply.utils.blocks import show_admin_form_error_messages diff --git a/hypha/core/wagtail/admin/options.py b/hypha/core/wagtail/admin/options.py index 5ee9bade85..346ff4aef8 100644 --- a/hypha/core/wagtail/admin/options.py +++ b/hypha/core/wagtail/admin/options.py @@ -1,10 +1,10 @@ from django.contrib.auth.models import Permission from django.core.exceptions import ImproperlyConfigured -from wagtail.contrib.modeladmin.helpers import PagePermissionHelper, PermissionHelper -from wagtail.contrib.modeladmin.options import WagtailRegisterable from wagtail.contrib.settings.models import BaseSiteSetting from wagtail.contrib.settings.registry import SettingMenuItem from wagtail.models import Page +from wagtail_modeladmin.helpers import PagePermissionHelper, PermissionHelper +from wagtail_modeladmin.options import WagtailRegisterable class SettingModelAdmin(WagtailRegisterable): diff --git a/hypha/settings/django.py b/hypha/settings/django.py index 39e4484b51..6b55b1d1d7 100644 --- a/hypha/settings/django.py +++ b/hypha/settings/django.py @@ -28,7 +28,7 @@ "django_htmx", "heroicons", "django_web_components", - "wagtail.contrib.modeladmin", + "wagtail_modeladmin", "wagtail.contrib.settings", "wagtail.contrib.forms", "wagtail.contrib.redirects", diff --git a/pyproject.toml b/pyproject.toml index f9adf07365..0cabf547d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,6 +62,7 @@ dependencies = [ "whitenoise~=6.8.2", "xhtml2pdf~=0.2.16", "xmltodict~=0.14.2", + "wagtail-modeladmin>=2.1.0", ] [dependency-groups] diff --git a/requirements/dev.txt b/requirements/dev.txt index 8c7b84e5d9..b6eef4a4d0 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1369,6 +1369,9 @@ wagtail==5.2.7 \ wagtail-factories==4.2.1 \ --hash=sha256:7a180fc1b074af7a78648c634740ee89d4dbb45899917744b66431d38155b6ae \ --hash=sha256:bfe158092982a2b30a3e603c482242905df0b163fc69573fa6f159df482175c5 +wagtail-modeladmin==2.1.0 \ + --hash=sha256:4ef3cfde4fb4858e8e17e26bb322ea1d44836c07b3e016d6921599caba67503a \ + --hash=sha256:a83502b0c02d2376cde33d81eb607ae10be95840b35072404cca877da161f7da watchdog==6.0.0 \ --hash=sha256:07df1fdd701c5d4c8e55ef6cf55b8f0120fe1aef7ef39a1c6fc6bc2e606d517a \ --hash=sha256:20ffe5b202af80ab4266dcd3e91aae72bf2da48c0d33bdb15c66658e685e94e2 \ diff --git a/requirements/prod.txt b/requirements/prod.txt index 2837faa8a4..c7bd1192fd 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -931,6 +931,9 @@ vine==5.1.0 \ wagtail==5.2.7 \ --hash=sha256:0cbb3003c4e69c4d88f56d9b1beacd525a06b8a4131103dca0c16e516dfc3455 \ --hash=sha256:76cf65ccdf11ab60ffd36162a82df17bfef13a33120159a95d424fa6f8767bc3 +wagtail-modeladmin==2.1.0 \ + --hash=sha256:4ef3cfde4fb4858e8e17e26bb322ea1d44836c07b3e016d6921599caba67503a \ + --hash=sha256:a83502b0c02d2376cde33d81eb607ae10be95840b35072404cca877da161f7da wcwidth==0.2.13 \ --hash=sha256:3da69048e4540d84af32131829ff948f1e022c1c6bdb8d6102117aac784f6859 \ --hash=sha256:72ea0c06399eb286d978fdedb6923a9eb47e1c486ce63e9b4e64fc18303972b5 diff --git a/uv.lock b/uv.lock index 9526ee5e2c..9bf1721a51 100644 --- a/uv.lock +++ b/uv.lock @@ -324,7 +324,7 @@ name = "click" version = "8.1.8" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "colorama", marker = "platform_system == 'Windows'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/b9/2e/0090cbf739cee7d23781ad4b89a9894a41538e4fcf4c31dcdd705b78eb8b/click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a", size = 226593 } wheels = [ @@ -1364,6 +1364,7 @@ dependencies = [ { name = "social-auth-app-django" }, { name = "svgwrite" }, { name = "wagtail" }, + { name = "wagtail-modeladmin" }, { name = "whitenoise" }, { name = "xhtml2pdf" }, { name = "xmltodict" }, @@ -1462,6 +1463,7 @@ requires-dist = [ { name = "social-auth-app-django", specifier = "~=5.4.1" }, { name = "svgwrite", specifier = "~=1.4.3" }, { name = "wagtail", specifier = "==5.2.7" }, + { name = "wagtail-modeladmin", specifier = ">=2.1.0" }, { name = "whitenoise", specifier = "~=6.8.2" }, { name = "xhtml2pdf", specifier = "~=0.2.16" }, { name = "xmltodict", specifier = "~=0.14.2" }, @@ -1792,7 +1794,7 @@ version = "1.6.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "click" }, - { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "colorama", marker = "platform_system == 'Windows'" }, { name = "ghp-import" }, { name = "jinja2" }, { name = "markdown" }, @@ -2879,7 +2881,7 @@ name = "qrcode" version = "7.4.2" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "colorama", marker = "platform_system == 'Windows'" }, { name = "pypng" }, { name = "typing-extensions" }, ] @@ -3471,7 +3473,7 @@ dependencies = [ { name = "filelock" }, { name = "fsspec" }, { name = "jinja2" }, - { name = "mkl", marker = "sys_platform == 'win32'" }, + { name = "mkl", marker = "platform_system == 'Windows'" }, { name = "networkx" }, { name = "sympy" }, { name = "typing-extensions" }, @@ -3490,7 +3492,7 @@ name = "tqdm" version = "4.67.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "colorama", marker = "platform_system == 'Windows'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/a8/4b/29b4ef32e036bb34e4ab51796dd745cdba7ed47ad142a9f4a1eb8e0c744d/tqdm-4.67.1.tar.gz", hash = "sha256:f8aef9c52c08c13a65f30ea34f4e5aac3fd1a34959879d7e59e63027286627f2", size = 169737 } wheels = [ @@ -3538,7 +3540,7 @@ name = "tzlocal" version = "5.2" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "tzdata", marker = "sys_platform == 'win32'" }, + { name = "tzdata", marker = "platform_system == 'Windows'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/04/d3/c19d65ae67636fe63953b20c2e4a8ced4497ea232c43ff8d01db16de8dc0/tzlocal-5.2.tar.gz", hash = "sha256:8d399205578f1a9342816409cc1e46a93ebd5755e39ea2d85334bea911bf0e6e", size = 30201 } wheels = [ @@ -3627,6 +3629,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/72/b9/11450ece998472b441ae9572f476c3ebd862869907a4a2eedc9d80727cc3/wagtail_factories-4.2.1-py2.py3-none-any.whl", hash = "sha256:7a180fc1b074af7a78648c634740ee89d4dbb45899917744b66431d38155b6ae", size = 10560 }, ] +[[package]] +name = "wagtail-modeladmin" +version = "2.1.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "wagtail" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/d1/bc/338d8a371099eb7c4e4cc2cdb4166d48771faa201e90797bf59c59b577ac/wagtail_modeladmin-2.1.0.tar.gz", hash = "sha256:a83502b0c02d2376cde33d81eb607ae10be95840b35072404cca877da161f7da", size = 136808 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d7/d7/6dc6f966cd3aeab43adc8dc8e2cee3adeda94ee2ede488e45eb598e74ec6/wagtail_modeladmin-2.1.0-py3-none-any.whl", hash = "sha256:4ef3cfde4fb4858e8e17e26bb322ea1d44836c07b3e016d6921599caba67503a", size = 265600 }, +] + [[package]] name = "watchdog" version = "6.0.0"