Skip to content

Commit

Permalink
Redirect to new Wiki 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikhorluck committed Aug 22, 2024
1 parent 0c13bdd commit 33019ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions onlineweb4/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from django.conf.urls.static import static
from django.contrib import admin
from django.http import HttpResponse
from django.shortcuts import redirect
from django.urls import include, path, re_path
from django.views.generic import TemplateView
from django_js_reverse.views import urls_js
Expand All @@ -19,6 +20,9 @@ class HomePageView(TemplateView):
template_name = "frontpage.html"


def redirect_to_new_wiki(request, path):
return redirect(f"https://wiki.online.ntnu.no/{path}", permanent=True)

urlpatterns = [
# Admin urls
re_path(r"^admin/doc/", include("django.contrib.admindocs.urls")),
Expand Down Expand Up @@ -58,6 +62,8 @@ class HomePageView(TemplateView):
),
# Wiki
re_path(r"^notify/", include("django_nyt.urls")),
re_path(r"^wiki/online/(?!komiteer/)(?P<path>([^/]+/)*)$", redirect_to_new_wiki),
re_path(r"^wiki/$", lambda r: redirect_to_new_wiki(r, "")),
re_path(r"^wiki/", include("wiki.urls")),
]

Expand Down
3 changes: 2 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<li><a href="https://online.ntnu.no/events">Arrangementer</a></li>
<li><a href="https://online.ntnu.no/career">Karriere</a></li>
<li><a href="https://online.ntnu.no/hobbygroups" class="hidden-sm">Interessegrupper</a></li>
<li><a href="/wiki/">Wiki</a></li>
<li><a href="https://wiki.online.ntnu.no/">Wiki</a></li>
<li><a href="/webshop/">Webshop</a></li>
</ul>
<ul class="mn-user-nav">
Expand All @@ -66,6 +66,7 @@
{% endif %}
{% if user.is_staff %}
<li><a href="/dashboard/">Dashboard</a></li>
<li><a href="/wiki/komiteer/">Intern wiki</a></li>
{% endif %}
<li>
<a href="{% url 'profiles' %}">
Expand Down

0 comments on commit 33019ea

Please sign in to comment.