Skip to content
Snippets Groups Projects
Commit 0bb53313 authored by Dan Nepejchal's avatar Dan Nepejchal Committed by jan.bednarik
Browse files

Regulace konopí - initial commit

- alter Page names with app name prefix
parent 1f826fb4
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ class Migration(migrations.Migration): ...@@ -20,7 +20,7 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.CreateModel( migrations.CreateModel(
name='SubPage', name='RegkonSubPage',
fields=[ 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')), ('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(icon='title', label='nadpis')), ('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')), ('carousel', wagtail.core.blocks.ListBlock(wagtail.images.blocks.ImageChooserBlock(label='obrázek'), icon='image', label='carousel')), ('FAQ', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('question', wagtail.core.blocks.TextBlock()), ('answer', wagtail.core.blocks.RichTextBlock())], template='regulace_konopi/blocks/faq.html'), label='faq')), ('meps', wagtail.core.blocks.StructBlock([('name', wagtail.core.blocks.CharBlock(label='název')), ('mep', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('name', wagtail.core.blocks.CharBlock(label='jméno')), ('approved', wagtail.core.blocks.ChoiceBlock(choices=[(1, 'schváleno'), (0, 'odmítá'), (-1, 'nevyjádřil se')], label='hlasoval'))])))], template='regulace_konopi/blocks/party.html'))], blank=True, verbose_name='obsah stránky')), ('content', wagtail.core.fields.StreamField([('title', wagtail.core.blocks.CharBlock(icon='title', label='nadpis')), ('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')), ('carousel', wagtail.core.blocks.ListBlock(wagtail.images.blocks.ImageChooserBlock(label='obrázek'), icon='image', label='carousel')), ('FAQ', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('question', wagtail.core.blocks.TextBlock()), ('answer', wagtail.core.blocks.RichTextBlock())], template='regulace_konopi/blocks/faq.html'), label='faq')), ('meps', wagtail.core.blocks.StructBlock([('name', wagtail.core.blocks.CharBlock(label='název')), ('mep', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('name', wagtail.core.blocks.CharBlock(label='jméno')), ('approved', wagtail.core.blocks.ChoiceBlock(choices=[(1, 'schváleno'), (0, 'odmítá'), (-1, 'nevyjádřil se')], label='hlasoval'))])))], template='regulace_konopi/blocks/party.html'))], blank=True, verbose_name='obsah stránky')),
...@@ -32,12 +32,12 @@ class Migration(migrations.Migration): ...@@ -32,12 +32,12 @@ class Migration(migrations.Migration):
bases=('wagtailcore.page', uniweb.models.SubpageMixin, wagtailmetadata.models.MetadataMixin, models.Model), bases=('wagtailcore.page', uniweb.models.SubpageMixin, wagtailmetadata.models.MetadataMixin, models.Model),
), ),
migrations.CreateModel( migrations.CreateModel(
name='HomePage', name='RegkonHomePage',
fields=[ 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')), ('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(icon='title', label='nadpis')), ('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')), ('carousel', wagtail.core.blocks.ListBlock(wagtail.images.blocks.ImageChooserBlock(label='obrázek'), icon='image', label='carousel'))], blank=True, verbose_name='obsah stránky')), ('content', wagtail.core.fields.StreamField([('title', wagtail.core.blocks.CharBlock(icon='title', label='nadpis')), ('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')), ('carousel', wagtail.core.blocks.ListBlock(wagtail.images.blocks.ImageChooserBlock(label='obrázek'), icon='image', label='carousel'))], 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')), ('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=['regulace_konopi.HomePage', 'regulace_konopi.SubPage']))]))], blank=True, verbose_name='horní menu')), ('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=['regulace_konopi.RegkonHomePage', 'regulace_konopi.RegkonSubPage']))]))], 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')), ('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={ options={
......
...@@ -44,7 +44,7 @@ class MenuItemBlock(blocks.StructBlock): ...@@ -44,7 +44,7 @@ class MenuItemBlock(blocks.StructBlock):
name = blocks.CharBlock(label="název") name = blocks.CharBlock(label="název")
page = blocks.PageChooserBlock( page = blocks.PageChooserBlock(
label="stránka", label="stránka",
page_type=["regulace_konopi.HomePage", "regulace_konopi.SubPage"], page_type=["regulace_konopi.RegkonHomePage", "regulace_konopi.RegkonSubPage"],
) )
class Meta: class Meta:
...@@ -72,7 +72,7 @@ class FaqBlock(blocks.StructBlock): ...@@ -72,7 +72,7 @@ class FaqBlock(blocks.StructBlock):
answer = blocks.RichTextBlock() answer = blocks.RichTextBlock()
class HomePage(MetadataPageMixin, Page): class RegkonHomePage(MetadataPageMixin, Page):
### FIELDS ### FIELDS
content = StreamField( content = StreamField(
[ [
...@@ -122,7 +122,7 @@ class HomePage(MetadataPageMixin, Page): ...@@ -122,7 +122,7 @@ class HomePage(MetadataPageMixin, Page):
### RELATIONS ### RELATIONS
subpage_types = [ subpage_types = [
"regulace_konopi.SubPage", "regulace_konopi.RegkonSubPage",
] ]
### OTHERS ### OTHERS
...@@ -135,7 +135,7 @@ class HomePage(MetadataPageMixin, Page): ...@@ -135,7 +135,7 @@ class HomePage(MetadataPageMixin, Page):
return self return self
class SubPage(Page, SubpageMixin, MetadataPageMixin): class RegkonSubPage(Page, SubpageMixin, MetadataPageMixin):
### FIELDS ### FIELDS
content = StreamField( content = StreamField(
...@@ -181,7 +181,7 @@ class SubPage(Page, SubpageMixin, MetadataPageMixin): ...@@ -181,7 +181,7 @@ class SubPage(Page, SubpageMixin, MetadataPageMixin):
### RELATIONS ### RELATIONS
parent_page_types = ["regulace_konopi.HomePage"] parent_page_types = ["regulace_konopi.RegkonHomePage"]
subpage_types = [] subpage_types = []
### OTHERS ### OTHERS
...@@ -192,7 +192,7 @@ class SubPage(Page, SubpageMixin, MetadataPageMixin): ...@@ -192,7 +192,7 @@ class SubPage(Page, SubpageMixin, MetadataPageMixin):
@property @property
def root_page(self): def root_page(self):
if not hasattr(self, "_root_page"): if not hasattr(self, "_root_page"):
self._root_page = self.get_ancestors().type(HomePage).specific().get() self._root_page = self.get_ancestors().type(RegkonHomePage).specific().get()
return self._root_page return self._root_page
def get_meta_image(self): def get_meta_image(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment