diff --git a/fiesta/apps/pages/admin.py b/fiesta/apps/pages/admin.py
index 665b47f6..0de3b5a3 100644
--- a/fiesta/apps/pages/admin.py
+++ b/fiesta/apps/pages/admin.py
@@ -1,6 +1,7 @@
from __future__ import annotations
from django.contrib import admin
+from django.utils.html import format_html
from mptt.admin import DraggableMPTTAdmin
from ..plugins.admin import BaseChildConfigurationAdmin
@@ -20,8 +21,8 @@ class PagesAdmin(DraggableMPTTAdmin):
list_display = (
"tree_actions",
"indented_title",
+ "external_url",
"default",
- "slug_path",
"order",
"section",
# ...more fields if you feel like it...
@@ -29,3 +30,12 @@ class PagesAdmin(DraggableMPTTAdmin):
list_display_links = ("indented_title",)
list_filter = ["section"]
expand_tree_by_default = True
+
+ @admin.display(
+ description="Page link",
+ )
+ def external_url(self, obj: Page):
+ return format_html(
+ "{url}",
+ url=obj.get_absolute_url(),
+ )
diff --git a/fiesta/apps/pages/models/page.py b/fiesta/apps/pages/models/page.py
index 0f21b8fb..45857ec8 100644
--- a/fiesta/apps/pages/models/page.py
+++ b/fiesta/apps/pages/models/page.py
@@ -93,7 +93,11 @@ def __str__(self):
return f"{self.title}"
def get_absolute_url(self) -> str:
- return self.section.section_base_url(None) + reverse("pages:single-page", kwargs=dict(slug=self.slug_path))
+ return self.section.section_base_url(None) + (
+ reverse("pages:default-page")
+ if self.default
+ else reverse("pages:single-page", kwargs=dict(slug=self.slug_path))
+ )
def save(self, *args, **kwargs):
super().save(*args, **kwargs)
diff --git a/fiesta/apps/pages/urls.py b/fiesta/apps/pages/urls.py
index 7925a969..73232b98 100644
--- a/fiesta/apps/pages/urls.py
+++ b/fiesta/apps/pages/urls.py
@@ -9,5 +9,5 @@
urlpatterns = [
# TODO: use custom converter https://docs.djangoproject.com/en/4.1/topics/http/urls/#registering-custom-path-converters
path("", SinglePageView.as_view(), name="single-page"),
- path("", DefaultPageView.as_view()),
+ path("", DefaultPageView.as_view(), name="default-page"),
]