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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hemp
Maják
Commits
a03e8929
Commit
a03e8929
authored
Nov 27, 2020
by
jarmil
Browse files
Options
Downloads
Patches
Plain Diff
WIP: PDP - homepage
parent
1fe4fba0
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
pdp/migrations/0001_initial.py
+511
-0
511 additions, 0 deletions
pdp/migrations/0001_initial.py
pdp/models.py
+64
-1
64 additions, 1 deletion
pdp/models.py
shared/mixins.py
+11
-0
11 additions, 0 deletions
shared/mixins.py
uniweb/models.py
+15
-8
15 additions, 8 deletions
uniweb/models.py
with
601 additions
and
9 deletions
pdp/migrations/0001_initial.py
0 → 100644
+
511
−
0
View file @
a03e8929
# Generated by Django 3.1.2 on 2020-11-27 09:39
import
django.db.models.deletion
import
wagtail.contrib.table_block.blocks
import
wagtail.core.blocks
import
wagtail.core.fields
import
wagtail.documents.blocks
import
wagtail.images.blocks
import
wagtailmetadata.models
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
(
"
wagtailcore
"
,
"
0052_pagelogentry
"
),
(
"
wagtailimages
"
,
"
0022_uploadedimage
"
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
"
PdpHomePage
"
,
fields
=
[
(
"
page_ptr
"
,
models
.
OneToOneField
(
auto_created
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
parent_link
=
True
,
primary_key
=
True
,
serialize
=
False
,
to
=
"
wagtailcore.page
"
,
),
),
(
"
content
"
,
wagtail
.
core
.
fields
.
StreamField
(
[
(
"
title
"
,
wagtail
.
core
.
blocks
.
CharBlock
(
group
=
"
nadpisy
"
,
icon
=
"
title
"
,
label
=
"
nadpis
"
,
template
=
"
uniweb/blocks/title.html
"
,
),
),
(
"
advanced_title
"
,
wagtail
.
core
.
blocks
.
StructBlock
(
[
(
"
align
"
,
wagtail
.
core
.
blocks
.
ChoiceBlock
(
choices
=
[
(
"
left
"
,
"
vlevo
"
),
(
"
center
"
,
"
uprostřed
"
),
(
"
right
"
,
"
vpravo
"
),
],
label
=
"
zarovnání
"
,
),
),
(
"
color
"
,
wagtail
.
core
.
blocks
.
ChoiceBlock
(
choices
=
[
(
"
black_on_white
"
,
"
černá na bílé
"
),
(
"
white_on_black
"
,
"
bílá na černé
"
),
(
"
white_on_blue
"
,
"
bílá na modré
"
),
(
"
white_on_cyan
"
,
"
bílá na tyrkysové
"
,
),
(
"
white_on_violet
"
,
"
bílá na fialové
"
,
),
],
label
=
"
barva
"
,
),
),
(
"
title
"
,
wagtail
.
core
.
blocks
.
CharBlock
(
label
=
"
nadpis
"
),
),
]
),
),
(
"
picture_title
"
,
wagtail
.
core
.
blocks
.
StructBlock
(
[
(
"
color
"
,
wagtail
.
core
.
blocks
.
ChoiceBlock
(
choices
=
[
(
"
black_on_white
"
,
"
černá na bílé
"
),
(
"
white_on_black
"
,
"
bílá na černé
"
),
(
"
white_on_blue
"
,
"
bílá na modré
"
),
(
"
white_on_cyan
"
,
"
bílá na tyrkysové
"
,
),
(
"
white_on_violet
"
,
"
bílá na fialové
"
,
),
],
label
=
"
barva
"
,
),
),
(
"
title
"
,
wagtail
.
core
.
blocks
.
CharBlock
(
label
=
"
nadpis
"
),
),
(
"
picture
"
,
wagtail
.
images
.
blocks
.
ImageChooserBlock
(
help_text
=
"
rozměr na výšku 75px nebo více (obrázek bude zmenšen na výšku 75px)
"
,
label
=
"
obrázek
"
,
),
),
]
),
),
(
"
text
"
,
wagtail
.
core
.
blocks
.
RichTextBlock
(
features
=
[
"
h2
"
,
"
h3
"
,
"
h4
"
,
"
h5
"
,
"
bold
"
,
"
italic
"
,
"
ol
"
,
"
ul
"
,
"
hr
"
,
"
link
"
,
"
document-link
"
,
"
image
"
,
"
superscript
"
,
"
subscript
"
,
"
strikethrough
"
,
"
blockquote
"
,
],
group
=
"
texty
"
,
label
=
"
text
"
,
template
=
"
uniweb/blocks/text.html
"
,
),
),
(
"
advanced_text
"
,
wagtail
.
core
.
blocks
.
StructBlock
(
[
(
"
align
"
,
wagtail
.
core
.
blocks
.
ChoiceBlock
(
choices
=
[
(
"
left
"
,
"
vlevo
"
),
(
"
center
"
,
"
uprostřed
"
),
(
"
right
"
,
"
vpravo
"
),
],
label
=
"
zarovnání
"
,
),
),
(
"
color
"
,
wagtail
.
core
.
blocks
.
ChoiceBlock
(
choices
=
[
(
"
black_on_white
"
,
"
černá na bílé
"
),
(
"
white_on_black
"
,
"
bílá na černé
"
),
(
"
white_on_blue
"
,
"
bílá na modré
"
),
(
"
white_on_cyan
"
,
"
bílá na tyrkysové
"
,
),
(
"
white_on_violet
"
,
"
bílá na fialové
"
,
),
],
label
=
"
barva
"
,
),
),
(
"
text
"
,
wagtail
.
core
.
blocks
.
RichTextBlock
(
features
=
[
"
h2
"
,
"
h3
"
,
"
h4
"
,
"
h5
"
,
"
bold
"
,
"
italic
"
,
"
ol
"
,
"
ul
"
,
"
hr
"
,
"
link
"
,
"
document-link
"
,
"
image
"
,
"
superscript
"
,
"
subscript
"
,
"
strikethrough
"
,
"
blockquote
"
,
],
label
=
"
text
"
,
),
),
]
),
),
(
"
text_columns
"
,
wagtail
.
core
.
blocks
.
StructBlock
(
[
(
"
left_text
"
,
wagtail
.
core
.
blocks
.
RichTextBlock
(
features
=
[
"
h2
"
,
"
h3
"
,
"
h4
"
,
"
h5
"
,
"
bold
"
,
"
italic
"
,
"
ol
"
,
"
ul
"
,
"
hr
"
,
"
link
"
,
"
document-link
"
,
"
image
"
,
"
superscript
"
,
"
subscript
"
,
"
strikethrough
"
,
"
blockquote
"
,
],
label
=
"
levý sloupec
"
,
),
),
(
"
right_text
"
,
wagtail
.
core
.
blocks
.
RichTextBlock
(
features
=
[
"
h2
"
,
"
h3
"
,
"
h4
"
,
"
h5
"
,
"
bold
"
,
"
italic
"
,
"
ol
"
,
"
ul
"
,
"
hr
"
,
"
link
"
,
"
document-link
"
,
"
image
"
,
"
superscript
"
,
"
subscript
"
,
"
strikethrough
"
,
"
blockquote
"
,
],
label
=
"
pravý sloupec
"
,
),
),
]
),
),
(
"
advanced_text_columns
"
,
wagtail
.
core
.
blocks
.
StructBlock
(
[
(
"
align
"
,
wagtail
.
core
.
blocks
.
ChoiceBlock
(
choices
=
[
(
"
left
"
,
"
vlevo
"
),
(
"
center
"
,
"
uprostřed
"
),
(
"
right
"
,
"
vpravo
"
),
],
label
=
"
zarovnání
"
,
),
),
(
"
color
"
,
wagtail
.
core
.
blocks
.
ChoiceBlock
(
choices
=
[
(
"
black_on_white
"
,
"
černá na bílé
"
),
(
"
white_on_black
"
,
"
bílá na černé
"
),
(
"
white_on_blue
"
,
"
bílá na modré
"
),
(
"
white_on_cyan
"
,
"
bílá na tyrkysové
"
,
),
(
"
white_on_violet
"
,
"
bílá na fialové
"
,
),
],
label
=
"
barva
"
,
),
),
(
"
left_text
"
,
wagtail
.
core
.
blocks
.
RichTextBlock
(
features
=
[
"
h2
"
,
"
h3
"
,
"
h4
"
,
"
h5
"
,
"
bold
"
,
"
italic
"
,
"
ol
"
,
"
ul
"
,
"
hr
"
,
"
link
"
,
"
document-link
"
,
"
image
"
,
"
superscript
"
,
"
subscript
"
,
"
strikethrough
"
,
"
blockquote
"
,
],
label
=
"
levý sloupec
"
,
),
),
(
"
right_text
"
,
wagtail
.
core
.
blocks
.
RichTextBlock
(
features
=
[
"
h2
"
,
"
h3
"
,
"
h4
"
,
"
h5
"
,
"
bold
"
,
"
italic
"
,
"
ol
"
,
"
ul
"
,
"
hr
"
,
"
link
"
,
"
document-link
"
,
"
image
"
,
"
superscript
"
,
"
subscript
"
,
"
strikethrough
"
,
"
blockquote
"
,
],
label
=
"
pravý sloupec
"
,
),
),
]
),
),
(
"
gallery
"
,
wagtail
.
core
.
blocks
.
ListBlock
(
wagtail
.
images
.
blocks
.
ImageChooserBlock
(
label
=
"
obrázek
"
),
group
=
"
ostatní
"
,
icon
=
"
image
"
,
label
=
"
galerie
"
,
template
=
"
uniweb/blocks/gallery.html
"
,
),
),
(
"
picture_list
"
,
wagtail
.
core
.
blocks
.
StructBlock
(
[
(
"
color
"
,
wagtail
.
core
.
blocks
.
ChoiceBlock
(
choices
=
[
(
"
black_on_white
"
,
"
černá na bílé
"
),
(
"
white_on_black
"
,
"
bílá na černé
"
),
(
"
white_on_blue
"
,
"
bílá na modré
"
),
(
"
white_on_cyan
"
,
"
bílá na tyrkysové
"
,
),
(
"
white_on_violet
"
,
"
bílá na fialové
"
,
),
],
label
=
"
barva
"
,
),
),
(
"
items
"
,
wagtail
.
core
.
blocks
.
ListBlock
(
wagtail
.
core
.
blocks
.
RichTextBlock
(
features
=
[
"
h2
"
,
"
h3
"
,
"
h4
"
,
"
h5
"
,
"
bold
"
,
"
italic
"
,
"
ol
"
,
"
ul
"
,
"
hr
"
,
"
link
"
,
"
document-link
"
,
"
image
"
,
"
superscript
"
,
"
subscript
"
,
"
strikethrough
"
,
"
blockquote
"
,
],
label
=
"
odstavec
"
,
),
label
=
"
odstavce
"
,
),
),
(
"
picture
"
,
wagtail
.
images
.
blocks
.
ImageChooserBlock
(
help_text
=
"
rozměr 25x25px nebo více (obrázek bude zmenšen na 25x25px)
"
,
label
=
"
obrázek
"
,
),
),
]
),
),
(
"
table
"
,
wagtail
.
contrib
.
table_block
.
blocks
.
TableBlock
(
group
=
"
ostatní
"
,
label
=
"
tabulka
"
,
template
=
"
uniweb/blocks/table.html
"
,
),
),
(
"
jupyter
"
,
wagtail
.
documents
.
blocks
.
DocumentChooserBlock
(
group
=
"
ostatní
"
,
label
=
"
Jupyter notebook
"
),
),
],
blank
=
True
,
verbose_name
=
"
obsah stránky
"
,
),
),
(
"
matomo_id
"
,
models
.
IntegerField
(
blank
=
True
,
null
=
True
,
verbose_name
=
"
Matomo ID pro sledování návštěvnosti
"
,
),
),
(
"
top_menu
"
,
wagtail
.
core
.
fields
.
StreamField
(
[
(
"
item
"
,
wagtail
.
core
.
blocks
.
StructBlock
(
[
(
"
name
"
,
wagtail
.
core
.
blocks
.
CharBlock
(
label
=
"
název
"
),
),
(
"
page
"
,
wagtail
.
core
.
blocks
.
PageChooserBlock
(
label
=
"
stránka
"
,
page_type
=
[
"
uniweb.UniwebHomePage
"
,
"
uniweb.UniwebFlexiblePage
"
,
],
),
),
]
),
)
],
blank
=
True
,
verbose_name
=
"
horní menu
"
,
),
),
(
"
search_image
"
,
models
.
ForeignKey
(
blank
=
True
,
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
SET_NULL
,
related_name
=
"
+
"
,
to
=
"
wagtailimages.image
"
,
verbose_name
=
"
Search image
"
,
),
),
],
options
=
{
"
verbose_name
"
:
"
Pirátská datová platforma
"
,
},
bases
=
(
"
wagtailcore.page
"
,
wagtailmetadata
.
models
.
MetadataMixin
,
models
.
Model
,
),
),
]
This diff is collapsed.
Click to expand it.
pdp/models.py
+
64
−
1
View file @
a03e8929
from
django.db
import
models
from
django.utils.translation
import
gettext_lazy
from
wagtail.admin.edit_handlers
import
(
FieldPanel
,
HelpPanel
,
MultiFieldPanel
,
StreamFieldPanel
,
)
from
wagtail.core.fields
import
StreamField
from
wagtail.core.models
import
Page
from
wagtail.images.edit_handlers
import
ImageChooserPanel
# Create your models here.
from
shared.mixins
import
MatomoMixin
from
tuning
import
help
from
uniweb
import
models
as
uniweb
class
PdpHomePage
(
Page
,
uniweb
.
UniwebContentMixin
,
uniweb
.
UniwebTopmenuMixin
,
uniweb
.
MetadataPageMixin
,
MatomoMixin
,
):
### PANELS
content_panels
=
Page
.
content_panels
+
[
StreamFieldPanel
(
"
content
"
),
]
promote_panels
=
[
MultiFieldPanel
(
[
FieldPanel
(
"
seo_title
"
),
FieldPanel
(
"
search_description
"
),
ImageChooserPanel
(
"
search_image
"
),
HelpPanel
(
help
.
build
(
help
.
IMPORTANT_TITLE
)),
],
gettext_lazy
(
"
Common page configuration
"
),
),
]
settings_panels
=
[
MultiFieldPanel
(
[
# definovano v MatomoMixin, TODO obstrahovat rozsireni settings_panels do mixinu
FieldPanel
(
"
matomo_id
"
),
],
"
nastavení webu
"
,
),
StreamFieldPanel
(
"
top_menu
"
),
# z uniwebTopmenuMixin
]
subpage_types
=
[
# "uniweb.UniwebFlexiblePage",
]
### OTHERS
class
Meta
:
verbose_name
=
"
Pirátská datová platforma
"
@property
def
root_page
(
self
):
return
self
This diff is collapsed.
Click to expand it.
shared/mixins.py
0 → 100644
+
11
−
0
View file @
a03e8929
from
django.db
import
models
class
MatomoMixin
(
models
.
Model
):
matomo_id
=
models
.
IntegerField
(
"
Matomo ID pro sledování návštěvnosti
"
,
blank
=
True
,
null
=
True
)
class
Meta
:
abstract
=
True
This diff is collapsed.
Click to expand it.
uniweb/models.py
+
15
−
8
View file @
a03e8929
...
...
@@ -16,6 +16,7 @@ from wagtail.images.blocks import ImageChooserBlock
from
wagtail.images.edit_handlers
import
ImageChooserPanel
from
wagtailmetadata.models
import
MetadataPageMixin
from
shared.mixins
import
MatomoMixin
from
tuning
import
help
from
.constants
import
(
...
...
@@ -221,18 +222,24 @@ class UniwebContentMixin(models.Model):
abstract
=
True
class
UniwebHomePage
(
Page
,
UniwebContentMixin
,
MetadataPageMixin
):
### FIELDS
class
UniwebTopmenuMixin
(
models
.
Model
):
# settings
matomo_id
=
models
.
IntegerField
(
"
Matomo ID pro sledování návštěvnosti
"
,
blank
=
True
,
null
=
True
)
top_menu
=
StreamField
(
[(
"
item
"
,
MenuItemBlock
())],
verbose_name
=
"
horní menu
"
,
blank
=
True
,
)
class
Meta
:
abstract
=
True
class
UniwebHomePage
(
Page
,
UniwebContentMixin
,
UniwebTopmenuMixin
,
MetadataPageMixin
,
MatomoMixin
):
### FIELDS
# settings
narrow_layout
=
models
.
BooleanField
(
"
zúžený obsah stránky
"
,
default
=
False
,
...
...
@@ -260,12 +267,12 @@ class UniwebHomePage(Page, UniwebContentMixin, MetadataPageMixin):
settings_panels
=
[
MultiFieldPanel
(
[
FieldPanel
(
"
matomo_id
"
),
FieldPanel
(
"
matomo_id
"
),
# z MatomoMixin
FieldPanel
(
"
narrow_layout
"
),
],
"
nastavení webu
"
,
),
StreamFieldPanel
(
"
top_menu
"
),
StreamFieldPanel
(
"
top_menu
"
),
# z UniwebTopmenuMixin
]
### RELATIONS
...
...
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