Skip to content

Commit ff6d51a

Browse files
authored
fix: homepage link in pages admin (#983)
1 parent e9bba25 commit ff6d51a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

bullet/web/views/page.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from competitions.models import Competition
2-
from django.http import Http404
2+
from countries.utils import country_reverse
3+
from django.http import HttpResponseRedirect
34
from django.shortcuts import get_object_or_404
45
from django.utils import translation
56
from django.views.generic import TemplateView
@@ -10,12 +11,14 @@
1011
class PageView(TemplateView):
1112
template_name = "web/page.html"
1213

14+
def get(self, request, *args, **kwargs):
15+
if kwargs["slug"] == "_homepage_":
16+
return HttpResponseRedirect(country_reverse("homepage"))
17+
return super().get(request, *args, **kwargs)
18+
1319
def get_context_data(self, **kwargs):
1420
context = super().get_context_data(**kwargs)
1521

16-
if kwargs["slug"] == "_homepage_":
17-
raise Http404()
18-
1922
competition = Competition.objects.get_current_competition(self.request.BRANCH)
2023
context["competition"] = competition
2124

0 commit comments

Comments
 (0)