diff --git a/kitsune/products/migrations/0020_remove_sumoplaceholderpage_page_ptr_and_more.py b/kitsune/products/migrations/0020_remove_sumoplaceholderpage_page_ptr_and_more.py
new file mode 100644
index 00000000000..0e0453a28b3
--- /dev/null
+++ b/kitsune/products/migrations/0020_remove_sumoplaceholderpage_page_ptr_and_more.py
@@ -0,0 +1,23 @@
+# Generated by Django 4.2.16 on 2024-10-14 03:54
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("products", "0019_alter_singleproductindexpage_body"),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name="sumoplaceholderpage",
+ name="page_ptr",
+ ),
+ migrations.DeleteModel(
+ name="SingleProductIndexPage",
+ ),
+ migrations.DeleteModel(
+ name="SumoPlaceholderPage",
+ ),
+ ]
diff --git a/kitsune/products/models/models.py b/kitsune/products/models.py
similarity index 98%
rename from kitsune/products/models/models.py
rename to kitsune/products/models.py
index 7bd1ad0e78e..7118636cc6b 100644
--- a/kitsune/products/models/models.py
+++ b/kitsune/products/models.py
@@ -8,8 +8,6 @@
from kitsune.sumo.urlresolvers import reverse
from kitsune.sumo.utils import webpack_static
-from wagtail.models import PreviewableMixin
-
HOT_TOPIC_SLUG = "hot"
@@ -29,7 +27,7 @@ class Meta:
abstract = True
-class Product(BaseProductTopic, PreviewableMixin):
+class Product(BaseProductTopic):
codename = models.CharField(max_length=255, blank=True, default="")
slug = models.SlugField()
image = ImagePlusField(
diff --git a/kitsune/products/models/__init__.py b/kitsune/products/models/__init__.py
deleted file mode 100644
index 327332ad532..00000000000
--- a/kitsune/products/models/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-from .models import * # noqa
-from .pages import * # noqa
diff --git a/kitsune/products/models/pages.py b/kitsune/products/models/pages.py
deleted file mode 100644
index 19c341d09ca..00000000000
--- a/kitsune/products/models/pages.py
+++ /dev/null
@@ -1,137 +0,0 @@
-from django.db import models
-from django.http import Http404
-
-from kitsune.products.models import Product
-from kitsune.wiki.facets import topics_for
-from kitsune.wiki.utils import get_featured_articles
-
-from typing import List
-
-from wagtail import blocks
-from wagtail.fields import StreamField
-from wagtail.admin.panels import FieldPanel
-from wagtail.models import Page
-from wagtail.snippets.blocks import SnippetChooserBlock
-
-
-class SumoPlaceholderPage(Page):
- """A page used to allow for child pages to be created
- so we can have a proper Wagtail tree structure"""
-
- settings_panels = Page.settings_panels + [
- FieldPanel("show_in_menus"),
- ]
- content_panels = [
- FieldPanel("title"),
- FieldPanel("slug"),
- ]
-
- promote_panels: List[FieldPanel] = []
- preview_modes: List[Page.preview_modes] = []
-
- is_placeholder = True
-
- def serve(self, request):
- raise Http404
-
-
-# Define Blocks for Stream Fields
-# Wagtail: This is a StructBlock that allows selection of a Product Snippet
-class ProductSnippetBlock(blocks.StructBlock):
- """Block for product snippets"""
-
- product = SnippetChooserBlock(target_model="products.Product", required=True)
-
- class Meta:
- template = "products/blocks/product_snippet_block.html"
- icon = "placeholder"
- label = "Product Card"
-
-
-class SearchBlock(blocks.StructBlock):
- """Block for the search form"""
-
- def get_context(self, value, parent_context=None):
- context = super().get_context(value, parent_context=parent_context)
- return context
-
- class Meta:
- template = "products/blocks/search_block.html"
- icon = "search"
- label = "Search Form"
-
-
-class CTABlock(blocks.StructBlock):
- """Block for the call to action"""
-
- headline = blocks.CharBlock(required=True, max_length=255)
- details = blocks.RichTextBlock(required=True)
- link = blocks.URLBlock(required=True)
- type = blocks.ChoiceBlock(
- choices=[
- ("Community", "Community"),
- ("Paid", "Paid"),
- ("Other", "Other"),
- ]
- )
-
- class Meta:
- template = "products/blocks/cta_block.html"
- icon = "plus-inverse"
- label = "Call to Action"
-
-
-class FeaturedArticlesBlock(blocks.StructBlock):
- """Block for the featured articles"""
-
- def get_context(self, value, parent_context=None):
- context = super().get_context(value, parent_context=parent_context)
- context["featured"] = get_featured_articles(product=context["product"])
- return context
-
- class Meta:
- template = "products/blocks/featured_articles_block.html"
- icon = "doc-full-inverse"
- label = "Featured Articles"
-
-
-class FrequentTopicsBlock(blocks.StructBlock):
- """Block for the frequent topics"""
-
- def get_context(self, value, parent_context=None):
- context = super().get_context(value, parent_context=parent_context)
- context["topics"] = topics_for(
- user=context["user"], product=context["product"], parent=None
- )
- return context
-
- class Meta:
- template = "products/blocks/frequent_topics_block.html"
- icon = "doc-full-inverse"
- label = "Frequent Topics"
- max = 1
-
-
-class SingleProductIndexPage(Page):
- """A page representing a product"""
-
- template = "products/product_wagtail.html"
-
- product = models.ForeignKey(Product, on_delete=models.PROTECT, related_name="product_index")
-
- body = StreamField(
- [
- ("search", SearchBlock()),
- ("cta", CTABlock()),
- ("featured_articles", FeaturedArticlesBlock()),
- ("product_snippet", ProductSnippetBlock()),
- ("frequent_topics", FrequentTopicsBlock()),
- ("text", blocks.RichTextBlock()),
- ]
- )
-
- content_panels = Page.content_panels + [FieldPanel("product"), FieldPanel("body")]
-
- class Meta:
- verbose_name = "Single Product Index"
- verbose_name_plural = "Single Product Indexes"
diff --git a/kitsune/products/tests/test_wt_pages.py b/kitsune/products/tests/test_wt_pages.py
deleted file mode 100644
index b73f445c177..00000000000
--- a/kitsune/products/tests/test_wt_pages.py
+++ /dev/null
@@ -1,74 +0,0 @@
-from django.http import Http404
-from django.test import RequestFactory
-
-from wagtail.models import Page
-from wagtail.test.utils import WagtailPageTestCase
-from wagtail.views import serve as wagtail_serve
-
-from kitsune.products.models import SingleProductIndexPage, SumoPlaceholderPage
-from kitsune.products.tests import ProductFactory
-
-
-class SumoCMSTests(WagtailPageTestCase):
- def test_can_create_dummy_page(self):
- """Test that our page was created"""
- homepage = Page.objects.get(url_path="/")
- product_dummy = SumoPlaceholderPage(title="Product Dummy", slug="products")
- homepage.add_child(instance=product_dummy)
-
- # See if it is now in the database
- retrieved = Page.objects.get(id=product_dummy.id)
- self.assertEqual(retrieved.title, "Product Dummy")
-
- def test_can_create_product_index_page(self):
- """Test that we can create a single product index page"""
- homepage = Page.objects.get(url_path="/")
- product_dummy = SumoPlaceholderPage(title="Product Dummy", slug="products")
- homepage.add_child(instance=product_dummy)
- test_product = ProductFactory(
- title="Firefox", slug="firefox", display_order=1, visible=True
- )
- product_index = SingleProductIndexPage(
- title="Firefox WT", slug="firefox", product=test_product
- )
- product_dummy.add_child(instance=product_index)
-
- # See if it is now in the database
- retrieved = Page.objects.get(id=product_index.id)
- self.assertEqual(retrieved.title, "Firefox WT", "The titles should match")
- self.assertEqual(retrieved.slug, "firefox", "The slugs should match")
-
- def test_can_serve_wt_product_index(self):
- """Test that we can create a single product index page and serve it"""
- homepage = Page.objects.get(url_path="/")
- product_dummy = SumoPlaceholderPage(title="Product Dummy", slug="products")
- homepage.add_child(instance=product_dummy)
- test_product = ProductFactory(
- title="Firefox", slug="firefox", display_order=1, visible=True
- )
- product_index = SingleProductIndexPage(
- title="Firefox WT", slug="firefox", product=test_product
- )
- product_dummy.add_child(instance=product_index)
-
- # Serve the page
- response = self.client.get("/en-US/products/firefox", follow=True)
- self.assertEqual(response.status_code, 200, "The page should be served successfully")
-
- def test_placeholder_returns_404(self):
- """Test that a placeholder page returns a 404"""
- homepage = Page.objects.get(url_path="/")
- product_dummy = SumoPlaceholderPage(title="Product Dummy", slug="products")
- homepage.add_child(instance=product_dummy)
-
- # Try assertPageIsRenderable
- dummy_page = Page.objects.get(id=product_dummy.id)
- self.assertPageIsRenderable(dummy_page, accept_404=True)
-
- # Serve the page
- request_factory = RequestFactory()
- request = request_factory.get("/en-US/products/")
- # Can't use test client here because it will follow the
- # redirect and return a 200
- with self.assertRaises(Http404):
- wagtail_serve(request, "/en-US/products/")
diff --git a/kitsune/products/views.py b/kitsune/products/views.py
index bbce691f1bd..bff13f20c67 100644
--- a/kitsune/products/views.py
+++ b/kitsune/products/views.py
@@ -7,7 +7,6 @@
from product_details import product_details
from kitsune.products.models import Product, Topic, TopicSlugHistory
-from kitsune.sumo.decorators import prefer_cms
from kitsune.wiki.decorators import check_simple_wiki_locale
from kitsune.wiki.facets import documents_for, topics_for
from kitsune.wiki.models import Document, Revision
@@ -23,7 +22,6 @@ def product_list(request):
@check_simple_wiki_locale
-@prefer_cms
def product_landing(request, slug):
"""The product landing page."""
if slug == "firefox-accounts":
diff --git a/kitsune/products/wagtail_hooks.py b/kitsune/products/wagtail_hooks.py
deleted file mode 100644
index e6c31a29cfa..00000000000
--- a/kitsune/products/wagtail_hooks.py
+++ /dev/null
@@ -1,27 +0,0 @@
-from wagtail.admin.panels import FieldPanel
-
-from wagtail.snippets.models import register_snippet
-from wagtail.snippets.views.snippets import SnippetViewSet
-
-from kitsune.products.models import Product
-
-
-class ProductViewSet(SnippetViewSet):
- model = Product
- panels = [
- FieldPanel("title"),
- FieldPanel("codename"),
- FieldPanel("slug"),
- FieldPanel("description"),
- FieldPanel("image"),
- FieldPanel("image_alternate"),
- FieldPanel("display_order"),
- FieldPanel("visible"),
- FieldPanel("platforms"),
- ]
-
- def get_preview_template(self, request, mode_name):
- return "products/product_card_preview.html"
-
-
-register_snippet(ProductViewSet)
diff --git a/kitsune/settings.py b/kitsune/settings.py
index 679131f535b..9606621f5af 100644
--- a/kitsune/settings.py
+++ b/kitsune/settings.py
@@ -9,7 +9,6 @@
import dj_database_url
import django_cache_url
from decouple import Csv, config
-from wagtail.admin.localization import WAGTAILADMIN_PROVIDED_LANGUAGES
from kitsune.lib.sumo_locales import LOCALES
@@ -447,10 +446,6 @@ def immutable_file_test(path, url):
"django_jinja.builtins.extensions.StaticFilesExtension",
"django_jinja.builtins.extensions.DjangoFiltersExtension",
"jinja2.ext.i18n",
- "wagtail.jinja2tags.core",
- "wagtail.admin.jinja2tags.userbar",
- "wagtail.images.jinja2tags.images",
- "wagtail.contrib.settings.jinja2tags.settings",
],
"policies": {
"ext.i18n.trimmed": True,
@@ -515,7 +510,6 @@ def immutable_file_test(path, url):
"kitsune.users.middleware.LogoutInvalidatedSessionsMiddleware",
"csp.middleware.CSPMiddleware",
"dockerflow.django.middleware.DockerflowMiddleware",
- "wagtail.contrib.redirects.middleware.RedirectMiddleware",
)
# SecurityMiddleware settings
@@ -554,7 +548,6 @@ def immutable_file_test(path, url):
AUTHENTICATION_BACKENDS = ("kitsune.sumo.readonlyauth.ReadOnlyBackend",)
OIDC_ENABLE = False
ENABLE_ADMIN = False
- WAGTAIL_ENABLE_ADMIN = False
else:
OIDC_ENABLE = config("OIDC_ENABLE", default=True, cast=bool)
ENABLE_ADMIN = config("ENABLE_ADMIN", default=OIDC_ENABLE, cast=bool)
@@ -1315,51 +1308,3 @@ def filter_exceptions(event, hint):
"MOZILLA_LOCATION_SERVICE",
default="https://location.services.mozilla.com/v1/country?key=fa6d7fc9-e091-4be1-b6c1-5ada5815ae9d", # noqa
)
-
-# Wagtail settings
-WAGTAIL_ENABLE = config("WAGTAIL_ENABLE", default=False, cast=bool)
-WAGTAIL_ENABLE_ADMIN = config("WAGTAIL_ENABLE_ADMIN", default=False, cast=bool)
-WAGTAIL_I18N_ENABLED = True
-WAGTAIL_CONTENT_LANGUAGES = LANGUAGES
-WAGTAILADMIN_PERMITTED_LANGUAGES = [
- # Only include items in this list that SuMO supports and that are included
- # in wagtail.admin.localization.WAGTAILADMIN_PROVIDED_LANGUAGES. These are
- # only used by Wagtail for localizing its admin interface.
- ("ar", "Arabic"),
- ("ca", "Catalan"),
- ("cs", "Czech"),
- ("de", "German"),
- ("el", "Greek"),
- ("en", "English"),
- ("es", "Spanish"),
- ("et", "Estonian"),
- ("fi", "Finnish"),
- ("fr", "French"),
- ("gl", "Galician"),
- ("hr", "Croatian"),
- ("hu", "Hungarian"),
- ("id-id", "Indonesian"),
- ("it", "Italian"),
- ("ja", "Japanese"),
- ("ko", "Korean"),
- ("lt", "Lithuanian"),
- ("nl", "Dutch"),
- ("fa", "Persian"),
- ("pl", "Polish"),
- ("pt-br", "Brazilian Portuguese"),
- ("pt-pt", "Portuguese"),
- ("ro", "Romanian"),
- ("ru", "Russian"),
- ("sv", "Swedish"),
- ("sk-sk", "Slovak"),
- ("sl", "Slovenian"),
- ("th", "Thai"),
- ("tr", "Turkish"),
- ("uk", "Ukrainian"),
- ("zh-hans", "Chinese (Simplified)"),
- ("zh-hant", "Chinese (Traditional)"),
-]
-WAGTAIL_SITE_NAME = config("WAGTAIL_SITE_NAME", default="Mozilla Support CMS")
-WAGTAILADMIN_BASE_URL = config("WAGTAILADMIN_BASE_URL", default="")
-WAGTAILIMAGES_MAX_UPLOAD_SIZE = IMAGE_MAX_FILESIZE
-WAGTAILDOCS_DOCUMENT_MODEL = "sumo.WagtailDocument"
diff --git a/kitsune/sumo/decorators.py b/kitsune/sumo/decorators.py
index 2ca797ca7c3..32ef0e23763 100644
--- a/kitsune/sumo/decorators.py
+++ b/kitsune/sumo/decorators.py
@@ -1,18 +1,12 @@
import json
-import re
from functools import wraps
-from csp.utils import build_policy
from django import http
from django.conf import settings
from django.core.exceptions import PermissionDenied
-from django.http import Http404
from kitsune.sumo.utils import is_ratelimited
-from wagtail.views import serve as wagtail_serve
-
-
# Copy/pasta from from https://gist.github.com/1405096
# TODO: Log the hell out of the exceptions.
JSON = "application/json"
@@ -132,51 +126,3 @@ def wrapper(*args, **kwargs):
return fn(*args, **kwargs)
return wrapper
-
-
-def csp_allow_inline_scripts_and_styles(fn):
- """
- Add a CSP header to the response of the decorated view that allows inline
- scripts and styles. The CSP header is created from the CSP values in the
- settings, and then updated to include the "'unsafe-inline'" source within
- both the "style-src" and "script-src" directives. The CSP header is inserted
- in the response so that the normal insertion of the header within the
- CSPMiddleware is bypassed. That, in turn, prevents the CSPMiddleware from
- adding the nonce sources, which would override the "'unsafe-inline'" sources
- and effectively cause them to be ignored.
- """
-
- @wraps(fn)
- def wrapped(*args, **kwargs):
- response = fn(*args, **kwargs)
- response["Content-Security-Policy"] = build_policy(
- update={
- "style-src": "'unsafe-inline'",
- "script-src": "'unsafe-inline'",
- }
- )
- return response
-
- return wrapped
-
-
-def remove_locale(url):
- # Define the regex pattern for locale (e.g., /en-US/ or /en-us/)
- locale_pattern = r"^/([a-z]{2}(-[a-zA-Z]{2})?)/"
- # Remove the locale part
- return re.sub(locale_pattern, "/", url)
-
-
-def prefer_cms(view_func):
- @wraps(view_func)
- def _wrapped_view(request, *args, **kwargs):
- path = remove_locale(request.path_info)
- try:
- wagtail_response = wagtail_serve(request, path)
- if wagtail_response.status_code == 200:
- return wagtail_response
- except Http404:
- pass # Continue to the original view if no Wagtail page is found
- return view_func(request, *args, **kwargs)
-
- return _wrapped_view
diff --git a/kitsune/sumo/migrations/0004_delete_wagtaildocument.py b/kitsune/sumo/migrations/0004_delete_wagtaildocument.py
new file mode 100644
index 00000000000..b909e3d986c
--- /dev/null
+++ b/kitsune/sumo/migrations/0004_delete_wagtaildocument.py
@@ -0,0 +1,16 @@
+# Generated by Django 4.2.16 on 2024-10-14 03:54
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("sumo", "0003_initial"),
+ ]
+
+ operations = [
+ migrations.DeleteModel(
+ name="WagtailDocument",
+ ),
+ ]
diff --git a/kitsune/sumo/models/models.py b/kitsune/sumo/models.py
similarity index 100%
rename from kitsune/sumo/models/models.py
rename to kitsune/sumo/models.py
diff --git a/kitsune/sumo/models/__init__.py b/kitsune/sumo/models/__init__.py
deleted file mode 100644
index 477cc368db5..00000000000
--- a/kitsune/sumo/models/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-from .models import LocaleField, ModelBase # noqa
-from .pages import WagtailDocument # noqa
diff --git a/kitsune/sumo/models/pages.py b/kitsune/sumo/models/pages.py
deleted file mode 100644
index 31d51a06fd3..00000000000
--- a/kitsune/sumo/models/pages.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from wagtail.documents.models import AbstractDocument
-
-
-class WagtailDocument(AbstractDocument):
- pass
diff --git a/kitsune/sumo/templates/wagtailadmin/404.html b/kitsune/sumo/templates/wagtailadmin/404.html
deleted file mode 100644
index 1155b9b907e..00000000000
--- a/kitsune/sumo/templates/wagtailadmin/404.html
+++ /dev/null
@@ -1,6 +0,0 @@
-{% extends "wagtailadmin/404.html" %}
-{% load sumo_tags %}
-
-{% block branding_logo %}
-
-{% endblock %}
diff --git a/kitsune/sumo/templates/wagtailadmin/admin_base.html b/kitsune/sumo/templates/wagtailadmin/admin_base.html
deleted file mode 100644
index cff1517d840..00000000000
--- a/kitsune/sumo/templates/wagtailadmin/admin_base.html
+++ /dev/null
@@ -1,63 +0,0 @@
-{% extends "wagtailadmin/admin_base.html" %}
-{% load i18n wagtailadmin_tags %}
-{% load sumo_tags %}
-
-{% block branding_favicon %}
-
-{% endblock %}
-
-{% block branding_title %}{{ _("Mozilla Support") }}{% endblock %}
-
-{% block extra_css %}
- {% include "entrypoints/wagtail.html" %}
-{% endblock %}
-
-{% block js %}
-
- {% wagtail_config as config %}
- {{ config|json_script:"wagtail-config" }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {% hook_output 'insert_global_admin_js' %}
-
- {% block extra_js %}{% endblock %}
-{% endblock %}
diff --git a/kitsune/sumo/templates/wagtailadmin/base.html b/kitsune/sumo/templates/wagtailadmin/base.html
deleted file mode 100644
index 84a5e1a1440..00000000000
--- a/kitsune/sumo/templates/wagtailadmin/base.html
+++ /dev/null
@@ -1,6 +0,0 @@
-{% extends "wagtailadmin/base.html" %}
-{% load sumo_tags %}
-
-{% block branding_logo %}
-
-{% endblock %}
diff --git a/kitsune/sumo/templates/wagtailadmin/home.html b/kitsune/sumo/templates/wagtailadmin/home.html
deleted file mode 100644
index 2e3710cec4c..00000000000
--- a/kitsune/sumo/templates/wagtailadmin/home.html
+++ /dev/null
@@ -1,6 +0,0 @@
-{% extends "wagtailadmin/home.html" %}
-{% load i18n %}
-
-{% block branding_welcome %}
-{{ _("Welcome to the Mozilla Support CMS") }}
-{% endblock %}
diff --git a/kitsune/sumo/templates/wagtailadmin/login.html b/kitsune/sumo/templates/wagtailadmin/login.html
deleted file mode 100644
index 54101e08b78..00000000000
--- a/kitsune/sumo/templates/wagtailadmin/login.html
+++ /dev/null
@@ -1,39 +0,0 @@
-{% extends "wagtailadmin/admin_base.html" %}
-{% load i18n wagtailadmin_tags sumo_tags %}
-{% block titletag %}{{ _("Sign in") }}{% endblock %}
-{% block bodyclass %}login{% endblock %}
-
-{% block furniture %}
-
- {% block branding_login %}
- {{ _("Mozilla Support CMS") }}
- {% endblock %}
-
-
-
-
- {% block above_login %}{% endblock %}
-
-
- {{ _("Sign in via SSO") }}
-
-
- {% block below_login %}{% endblock %}
-
- {% block branding_logo %}
-