added TINYWIKI_HOME settings for settings the app-specific homepages of the wiki

This commit is contained in:
2025-12-30 05:32:47 +01:00
parent e4fd21f998
commit 14c1d9d978
2 changed files with 5 additions and 4 deletions

View File

@@ -35,4 +35,6 @@ TINYWIKI_BASE_TEMPLATE = getattr(
"tinywiki/base.html") "tinywiki/base.html")
) )
TINYWIKI_HOME = getattr(settings, "TINYWIKI_HOME", "tw-home")
USE_BOOTSTRAP = getattr(settings, "USE_BOOTSTRAP", False) USE_BOOTSTRAP = getattr(settings, "USE_BOOTSTRAP", False)

View File

@@ -11,7 +11,7 @@ import string
from ..models import Page from ..models import Page
from ..enums import WikiPageStatus from ..enums import WikiPageStatus
from django.utils.translation import ngettext, gettext as _ from django.utils.translation import ngettext, gettext as _
from ..import settings
# Create your views here. # Create your views here.
class HomeView(View): class HomeView(View):
@@ -19,7 +19,7 @@ class HomeView(View):
def get(self, request): def get(self, request):
try: try:
page = Page.objects.get(slug='tw-home') page = Page.objects.get(slug=settings.TINYWIKI_HOME)
if (not Page.status == WikiPageStatus.PUBLISHED if (not Page.status == WikiPageStatus.PUBLISHED
and not request.user.is_staff and not request.user.is_staff
and not request.user.has_perm('page.view-all')): and not request.user.has_perm('page.view-all')):
@@ -105,7 +105,6 @@ class TocView(View):
else: else:
pages_1 = toc_entries[split:] pages_1 = toc_entries[split:]
if (key.startswith('0') or key == '#'): if (key.startswith('0') or key == '#'):
toc_section = key toc_section = key
else: else: