From d988c935508606eebc00feec880258b36ac71715 Mon Sep 17 00:00:00 2001 From: Pujan Thapa Date: Tue, 24 Feb 2026 14:54:54 +0100 Subject: [PATCH] Fix #2645: Add permanent redirects for legacy sponsorship pages --- pydotorg/tests/test_views.py | 8 ++++++++ pydotorg/urls.py | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pydotorg/tests/test_views.py b/pydotorg/tests/test_views.py index b21c54b57..5f9387b1c 100644 --- a/pydotorg/tests/test_views.py +++ b/pydotorg/tests/test_views.py @@ -34,3 +34,11 @@ def test_download_index(self): self.assertContains(response, "Browse Python 3.6.0 Documentation") self.assertContains(response, "https://docs.python.org/3/whatsnew/3.6.html") self.assertContains(response, "What's new in Python 3.6") + + def test_legacy_sponsor_redirects(self): + """Test that old sponsorship pages correctly redirect to modern active ones.""" + response = self.client.get("/psf/sponsorship-old/") + self.assertRedirects(response, "/psf/sponsors/", status_code=301) + + response = self.client.get("/psf/forms/sponsor-application/") + self.assertRedirects(response, "/sponsors/application/", status_code=301) diff --git a/pydotorg/urls.py b/pydotorg/urls.py index 3cb9f32ea..e91f08852 100644 --- a/pydotorg/urls.py +++ b/pydotorg/urls.py @@ -5,7 +5,7 @@ from django.contrib import admin from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.urls import include, path, re_path -from django.views.generic.base import TemplateView +from django.views.generic.base import RedirectView, TemplateView from apps.cms.views import custom_404 from apps.downloads.views import ReleaseEditButton @@ -35,6 +35,14 @@ path("blogs/", include("apps.blogs.urls")), path("inner/", TemplateView.as_view(template_name="python/inner.html"), name="inner"), # other section landing pages + path( + "psf/sponsorship-old/", + RedirectView.as_view(url="/psf/sponsors/", permanent=True), + ), + path( + "psf/forms/sponsor-application/", + RedirectView.as_view(url="/sponsors/application/", permanent=True), + ), path("psf-landing/", TemplateView.as_view(template_name="psf/index.html"), name="psf-landing"), path("psf/sponsors/", TemplateView.as_view(template_name="psf/sponsors-list.html"), name="psf-sponsors"), path("docs-landing/", TemplateView.as_view(template_name="docs/index.html"), name="docs-landing"),