Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Maják
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Maják
Commits
b8888a5b
Commit
b8888a5b
authored
11 months ago
by
Alexa Valentová
Browse files
Options
Downloads
Patches
Plain Diff
fix(?) MS Pardubice menu
parent
ba925522
Branches
Branches containing commit
No related tags found
2 merge requests
!1040
Release
,
!1039
fix(?) MS Pardubice menu
Pipeline
#18878
passed
11 months ago
Stage: build
Changes
2
Pipelines
3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
district/migrations/0241_auto_20240701_1616.py
+25
-0
25 additions, 0 deletions
district/migrations/0241_auto_20240701_1616.py
district/models.py
+15
-1
15 additions, 1 deletion
district/models.py
with
40 additions
and
1 deletion
district/migrations/0241_auto_20240701_1616.py
0 → 100644
+
25
−
0
View file @
b8888a5b
# 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
)
]
This diff is collapsed.
Click to expand it.
district/models.py
+
15
−
1
View file @
b8888a5b
...
...
@@ -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
"
)),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment