Skip to content
Snippets Groups Projects
Commit b8888a5b authored by Alexa Valentová's avatar Alexa Valentová
Browse files

fix(?) MS Pardubice menu

parent ba925522
Branches
No related tags found
2 merge requests!1040Release,!1039fix(?) MS Pardubice menu
Pipeline #18878 passed
# Generated by Django 5.0.6 on 2024-07-01 14:16
from django.db import migrations
def fix_menu(apps, schema_editor):
from district.models import DistrictHomePage
new_menu = []
for page in DistrictHomePage.objects.all():
if page.title == "Piráti Pardubicko":
page.menu = []
page.save()
class Migration(migrations.Migration):
dependencies = [
('district', '0240_alter_districthomepage_content'),
]
operations = [
migrations.RunPython(fix_menu)
]
......@@ -20,7 +20,7 @@ from wagtail.admin.panels import (
TabbedInterface,
)
from wagtail.fields import RichTextField, StreamField
from wagtail.models import Orderable, Page
from wagtail.models import Orderable, Page, Site
from wagtailmetadata.models import MetadataPageMixin
from calendar_utils.models import CalendarMixin
......@@ -65,6 +65,20 @@ from shared.utils import make_promote_panels, strip_all_html_tags, subscribe_to_
from . import blocks
from .forms import JekyllImportForm
from wagtail import hooks
@hooks.register('construct_page_chooser_queryset')
def limit_page_chooser_to_site_specific_pages(pages, request):
try:
site = Site.find_for_request(request)
return pages.in_site(site)
except Exception as e:
print(e)
# couldn't filter by site so return untouched pages queryset
return pages
CONTENT_BLOCKS = DEFAULT_CONTENT_BLOCKS + [
("chart", ChartBlock(template="district/blocks/chart.html")),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment