Skip to content

Commit

Permalink
Merge branch 'feature-add-redirects-for-old-blog-posts'
Browse files Browse the repository at this point in the history
  • Loading branch information
kbeker committed Nov 21, 2019
2 parents 7548791 + 19a72e7 commit c9e01bc
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
11 changes: 11 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
### v1.4.0

##### Features

- Feature add redirects for old blog posts ([#135](https://github.com/Code-Poets/project-liberation/pull/135))

##### Bugfixes

- Bugfix change `cheminformatic` to `cheminformatics`s ([#134](https://github.com/Code-Poets/project-liberation/pull/134))


### v1.3.0

##### Features
Expand Down
3 changes: 3 additions & 0 deletions project_liberation/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.sites',
'django.contrib.staticfiles',
# Wagtail
'wagtail.contrib.forms',
Expand Down Expand Up @@ -380,3 +381,5 @@
WAGTAIL_APPEND_SLASH = False

WAGTAILIMAGES_MAX_UPLOAD_SIZE = 25 * 1024 * 1024

SITE_ID = 1
24 changes: 24 additions & 0 deletions project_liberation/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,33 @@
from django.contrib import admin
from django.urls import include

from project_liberation.views import redirect_view

urlpatterns = [
url(r"^admin/", admin.site.urls),
url(r"^", include("company_website.urls")),
url(r"^blog/", include("blog.urls")),
url(r"^blog-cms/", include("blog.urls_admin")),
# redirects for older blog posts
url(
r"^the-pycon-pl-2019-impressions/",
redirect_view,
kwargs={"blog_article_address": "the-pycon-pl-2019-impressions/"},
),
url(r"^hello-world/", redirect_view, kwargs={"blog_article_address": "hello-world/"}),
url(
r"^ico-vs-sto-whats-best-for-your-startup/",
redirect_view,
kwargs={"blog_article_address": "ico-vs-sto-whats-best-for-your-startup/"},
),
url(
r"^how-prepare-your-mvp-idea-and-make-sure-your-customers-love-it/",
redirect_view,
kwargs={"blog_article_address": "how-prepare-your-mvp-idea-and-make-sure-your-customers-love-it/"},
),
url(
r"^code-poets-named-top-developers-poland/",
redirect_view,
kwargs={"blog_article_address": "code-poets-named-top-developers-poland/"},
),
]
9 changes: 9 additions & 0 deletions project_liberation/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.contrib.sites.shortcuts import get_current_site
from django.core.handlers.wsgi import WSGIRequest
from django.http import HttpResponseRedirect


def redirect_view(request: WSGIRequest, **kwargs: dict) -> HttpResponseRedirect:
domain = get_current_site(request)
blog_article_address = kwargs["blog_article_address"]
return HttpResponseRedirect(f"https://{domain}/blog/{blog_article_address}")

0 comments on commit c9e01bc

Please sign in to comment.