Compare commits

...

2 commits

Author SHA1 Message Date
PCoder
8edd7a477b Cleanup unused code 2022-07-11 13:10:33 +05:30
PCoder
51e17687dd Use RawHTMLBlock instead of TableBlock 2022-07-11 13:10:06 +05:30
3 changed files with 9 additions and 45 deletions

View file

@ -17,7 +17,7 @@ from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel, InlinePane
from wagtail.images.blocks import ImageChooserBlock from wagtail.images.blocks import ImageChooserBlock
from wagtail.images.edit_handlers import ImageChooserPanel from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.search import index from wagtail.search import index
from wagtail.contrib.table_block.blocks import TableBlock from wagtail.core.blocks import RawHTMLBlock
from puput.models import EntryPage, BlogPage from puput.models import EntryPage, BlogPage
from feedler.models import Entry, Stream from feedler.models import Entry, Stream
@ -50,32 +50,27 @@ class ArticleIndexPage(Page):
'intro_en', 'intro_en',
) )
table_en = StreamField( table_en = StreamField(
[ [
('table_en', TableBlock()) ('table_en', RawHTMLBlock())
], ],
null=True, null=True,
blank = True, blank=True,
) )
table_de = StreamField( table_de = StreamField(
[ [
('table_de', TableBlock()) ('table_de', RawHTMLBlock())
], ],
null=True, null=True,
blank = True, blank=True,
) )
table_fr = StreamField( table_fr = StreamField(
[ [
('table_fr', TableBlock()) ('table_fr', RawHTMLBlock())
], ],
null=True, null=True,
blank = True, blank=True,
) )
#table_en = TableBlock()
#table_fr = TableBlock()
#table_de = TableBlock()
trans_table = TranslatedField( trans_table = TranslatedField(
'table_de', 'table_de',
'table_fr', 'table_fr',
@ -204,14 +199,6 @@ class ArticlePage(Page):
'body_fr', 'body_fr',
'body_en', 'body_en',
) )
table_en = TableBlock()
table_fr = TableBlock()
table_de = TableBlock()
trans_table = TranslatedField(
'table_en',
'table_fr',
'table_de',
)
date = models.DateField("Date", null=True, blank=True) date = models.DateField("Date", null=True, blank=True)
@ -305,15 +292,6 @@ class HomePage(Page):
'body_en', 'body_en',
) )
#table_en = TableBlock()
#table_fr = TableBlock()
#table_de = TableBlock()
#trans_table = TranslatedField(
# 'table_en',
# 'table_fr',
# 'table_de',
#)
infos_de = StreamField([ infos_de = StreamField([
('info', InfoBlock()) ('info', InfoBlock())
], null=True, blank=True) ], null=True, blank=True)
@ -328,27 +306,24 @@ class HomePage(Page):
'infos_fr', 'infos_fr',
'infos_en', 'infos_en',
) )
# content_table = StreamField(TableBlock(), verbose_name=_('Content Table'), blank=True)
content_panels = Page.content_panels + [ content_panels = Page.content_panels + [
MultiFieldPanel([ MultiFieldPanel([
FieldPanel('intro_de', classname="full"), FieldPanel('intro_de', classname="full"),
FieldPanel('body_de', classname="full"), FieldPanel('body_de', classname="full"),
StreamFieldPanel('infos_de'), StreamFieldPanel('infos_de'),
#StreamFieldPanel('table_de'),
], heading="Deutsch", ], heading="Deutsch",
classname="collapsible collapsed"), classname="collapsible collapsed"),
MultiFieldPanel([ MultiFieldPanel([
FieldPanel('intro_fr', classname="full"), FieldPanel('intro_fr', classname="full"),
FieldPanel('body_fr', classname="full"), FieldPanel('body_fr', classname="full"),
StreamFieldPanel('infos_fr'), StreamFieldPanel('infos_fr'),
#StreamFieldPanel('table_fr'),
], heading="Français", ], heading="Français",
classname="collapsible collapsed"), classname="collapsible collapsed"),
MultiFieldPanel([ MultiFieldPanel([
FieldPanel('intro_en', classname="full"), FieldPanel('intro_en', classname="full"),
FieldPanel('body_en', classname="full"), FieldPanel('body_en', classname="full"),
StreamFieldPanel('infos_en'), StreamFieldPanel('infos_en'),
#StreamFieldPanel('table_fr'),
], heading="English", ], heading="English",
classname="collapsible collapsed"), classname="collapsible collapsed"),
] ]

View file

@ -27,19 +27,9 @@
<p class="block-{{ block.block_type }}"> <p class="block-{{ block.block_type }}">
{% include_block block %} {% include_block block %}
</p> </p>
{% endfor %}
</div>
<h1>Mmmm</h1>
<!-- Table content -->
<div class="article-table" role="main">
{% for block in page.trans_table %}
{% if block.block_type == 'table' %}
Inside if
{% include_block block %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div>
<!-- Infoblocks --> <!-- Infoblocks -->
<div class="row infoblocks"> <div class="row infoblocks">

View file

@ -44,7 +44,6 @@ INSTALLED_APPS = [
'wagtail.contrib.redirects', 'wagtail.contrib.redirects',
'wagtail.contrib.search_promotions', 'wagtail.contrib.search_promotions',
"wagtail.contrib.legacy.richtext", "wagtail.contrib.legacy.richtext",
'wagtail.contrib.table_block',
'wagtail.embeds', 'wagtail.embeds',
'wagtail.sites', 'wagtail.sites',