aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ChrisJL <[email protected]>2021-05-14 21:21:25 +0100
committerGravatar GitHub <[email protected]>2021-05-14 21:21:25 +0100
commit0b3e6140777976ac8aacf83ad77cf075c5dcb937 (patch)
treeffe6994e438a3e48b32d647d53dd0f1bc2764930
parentMerge pull request #493 from dawnofmidnight/contributing-env-vars (diff)
parentMerge branch 'main' into joe/redirect-app-301 (diff)
Merge pull request #492 from python-discord/joe/redirect-app-301
Enable permanent redirects for redirect app
-rw-r--r--pydis_site/apps/redirect/redirects.yaml6
-rw-r--r--pydis_site/apps/redirect/tests.py2
-rw-r--r--pydis_site/apps/redirect/views.py4
3 files changed, 8 insertions, 4 deletions
diff --git a/pydis_site/apps/redirect/redirects.yaml b/pydis_site/apps/redirect/redirects.yaml
index ce789b61..c5f113fb 100644
--- a/pydis_site/apps/redirect/redirects.yaml
+++ b/pydis_site/apps/redirect/redirects.yaml
@@ -70,6 +70,12 @@ off-topic_redirect:
redirect_route: "content:page_category"
redirect_arguments: ["guides/pydis-guides/off-topic-etiquette"]
+good_questions_redirect_alt:
+ # In a few places we were linking to a version outside of the guides app.
+ original_path: pages/asking-good-questions/
+ redirect_route: "content:page_category"
+ redirect_arguments: ["guides/pydis-guides/asking-good-questions"]
+
# Resources
resources_index_redirect:
original_path: pages/resources/
diff --git a/pydis_site/apps/redirect/tests.py b/pydis_site/apps/redirect/tests.py
index fce2642f..2cfa3478 100644
--- a/pydis_site/apps/redirect/tests.py
+++ b/pydis_site/apps/redirect/tests.py
@@ -56,6 +56,6 @@ class RedirectTests(TestCase):
f"home:{data['redirect_route']}",
args=expected_args
),
- status_code=302
+ status_code=301
)
self.assertEqual(resp.status_code, 200)
diff --git a/pydis_site/apps/redirect/views.py b/pydis_site/apps/redirect/views.py
index 9dc9881a..21180cdf 100644
--- a/pydis_site/apps/redirect/views.py
+++ b/pydis_site/apps/redirect/views.py
@@ -6,9 +6,7 @@ from django.views.generic import RedirectView
class CustomRedirectView(RedirectView):
"""Extended RedirectView for manual route args."""
- # We want temporary redirects for the time being, after this is running on prod and
- # stable we can enable permanent redirects.
- permanent = False
+ permanent = True
static_args = ()
prefix_redirect = False