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
c5f0fb93
Commit
c5f0fb93
authored
2 years ago
by
Ondrej Rehounek
Browse files
Options
Downloads
Patches
Plain Diff
main: WIP models
parent
1d2da4a0
No related branches found
No related tags found
2 merge requests
!607
Pirati.cz
,
!575
Feature/pirati cz
Pipeline
#9121
passed
2 years ago
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
main/blocks.py
+24
-1
24 additions, 1 deletion
main/blocks.py
main/models.py
+51
-4
51 additions, 4 deletions
main/models.py
with
75 additions
and
5 deletions
main/blocks.py
+
24
−
1
View file @
c5f0fb93
from
wagtail.core.blocks
import
CharBlock
,
PageChooserBlock
,
StructBlock
,
URLBlock
# HomePageCarouselBlock
# RecentWork/TweetsBlock
# NewsBlock
...
...
@@ -7,6 +9,27 @@
# WorkTimelineBlock
# ArticleLinkBlock
# ProgramBlock
# PersonBlock
class
PersonContactBlock
(
StructBlock
):
position
=
CharBlock
(
label
=
"
Název pozice
"
,
required
=
False
)
# email, phone?
person
=
PageChooserBlock
(
label
=
"
Osoba
"
,
page_type
=
[
"
district.DistrictPersonPage
"
],
)
class
Meta
:
icon
=
"
user
"
label
=
"
Osoba s volitelnou pozicí
"
class
PersonContactBoxBlock
(
StructBlock
):
title
=
CharBlock
(
label
=
"
Titulek
"
)
subtitle
=
CharBlock
(
label
=
"
Podtitulek
"
)
button_link
=
URLBlock
()
button_text
=
CharBlock
(
label
=
"
Text tlačítka
"
)
# TwitterCarouselBlock
# ContactBlock
This diff is collapsed.
Click to expand it.
main/models.py
+
51
−
4
View file @
c5f0fb93
from
django.db
import
models
from
django.shortcuts
import
render
from
wagtail.admin.edit_handlers
import
FieldPanel
,
ObjectList
,
TabbedInterface
from
wagtail.core.fields
import
RichTextField
,
StreamField
from
wagtail.core.models
import
Page
from
wagtailmetadata.models
import
MetadataPageMixin
from
shared.models
import
(
# ArticleMixin,; ExtendedMetadataPageMixin,; SubpageMixin,
from
shared.const
import
RICH_TEXT_DEFAULT_FEATURES
from
shared.models
import
(
ExtendedMetadataHomePageMixin
,
ExtendedMetadataPageMixin
,
MenuMixin
,
SubpageMixin
,
)
from
shared.utils
import
make_promote_panels
#
from . import blocks
from
.
import
blocks
class
MainHomePage
(
MenuMixin
,
ExtendedMetadataHomePageMixin
,
MetadataPageMixin
,
Page
):
...
...
@@ -20,7 +25,11 @@ class MainHomePage(MenuMixin, ExtendedMetadataHomePageMixin, MetadataPageMixin,
)
# header - fb, twitter, insta, youtube, dary, nalodeni
# footer - stream field loadovany pres page.root_page?
footer
=
StreamField
(
[(
"
item
"
,
blocks
.
PersonContactBlock
())],
verbose_name
=
"
Kontaktní boxy
"
,
blank
=
True
,
)
settings_panels
=
[
FieldPanel
(
"
matomo_id
"
)]
...
...
@@ -41,7 +50,7 @@ class MainHomePage(MenuMixin, ExtendedMetadataHomePageMixin, MetadataPageMixin,
# MainProgramPage
# MainPeoplePage
# MainPersonPage
#
MainContactPage
"
main.
MainContactPage
"
]
### OTHERS
...
...
@@ -56,3 +65,41 @@ class MainHomePage(MenuMixin, ExtendedMetadataHomePageMixin, MetadataPageMixin,
@property
def
root_page
(
self
):
return
self
class
MainContactPage
(
ExtendedMetadataPageMixin
,
SubpageMixin
,
MetadataPageMixin
,
Page
):
### FIELDS
contact_people
=
StreamField
(
[(
"
item
"
,
blocks
.
PersonContactBlock
())],
verbose_name
=
"
Kontaktní osoby
"
,
blank
=
True
,
)
contact_boxes
=
StreamField
(
[(
"
item
"
,
blocks
.
PersonContactBlock
())],
verbose_name
=
"
Kontaktní boxy
"
,
blank
=
True
,
)
text
=
RichTextField
(
"
Text
"
,
blank
=
True
,
features
=
RICH_TEXT_DEFAULT_FEATURES
)
### PANELS
content_panels
=
Page
.
content_panels
+
[
FieldPanel
(
"
contact_people
"
),
FieldPanel
(
"
contact_boxes
"
),
FieldPanel
(
"
text
"
),
]
promote_panels
=
make_promote_panels
()
settings_panels
=
[]
### RELATIONS
parent_page_types
=
[
"
main.MainHomePage
"
]
subpage_types
=
[]
### OTHERS
class
Meta
:
verbose_name
=
"
Kontakty
"
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