Skip to content
Snippets Groups Projects
Commit 94d473d3 authored by jarmil's avatar jarmil
Browse files

WIP: jupyter notebooks - priprava

parent 5930868f
No related branches found
No related tags found
2 merge requests!121Sync test,!118Jupyter
# Generated by Django 3.1.1 on 2020-09-15 06:12
import wagtail.contrib.table_block.blocks
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.documents.blocks
import wagtail.images.blocks
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("uniweb", "0006_auto_20200911_1426"),
]
operations = [
migrations.AlterField(
model_name="uniwebflexiblepage",
name="content",
field=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",
),
),
(
"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",
),
),
]
),
),
(
"gallery",
wagtail.core.blocks.ListBlock(
wagtail.images.blocks.ImageChooserBlock(label="obrázek"),
icon="image",
label="galerie",
),
),
(
"table",
wagtail.contrib.table_block.blocks.TableBlock(
label="tabulka", template="uniweb/snippet_table.html"
),
),
(
"jupyter",
wagtail.documents.blocks.DocumentChooserBlock(
label="Jupyter notebook"
),
),
],
blank=True,
verbose_name="obsah stránky",
),
),
]
......@@ -10,6 +10,7 @@ from wagtail.contrib.table_block.blocks import TableBlock
from wagtail.core import blocks
from wagtail.core.fields import StreamField
from wagtail.core.models import Page
from wagtail.documents.blocks import DocumentChooserBlock
from wagtail.images.blocks import ImageChooserBlock
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtailmetadata.models import MetadataPageMixin
......@@ -158,6 +159,7 @@ class UniwebFlexiblePage(Page, SubpageMixin, MetadataPageMixin):
"table",
TableBlock(label="tabulka", template="uniweb/snippet_table.html",),
),
("jupyter", DocumentChooserBlock(label="Jupyter notebook")),
],
verbose_name="obsah stránky",
blank=True,
......
{% load static wagtailcore_tags wagtailimages_tags wagtailmetadata_tags %}
{% load uniweb_filters static wagtailcore_tags wagtailimages_tags wagtailmetadata_tags %}
<!doctype html>
<html lang="cs">
<head>
......
......@@ -42,5 +42,11 @@
</div>
{% endif %}
{% if block.block_type == "jupyter" %}
<div class="content-block my-4 clearfix{% if forloop.first %} mt-8 lg:mt-12{% endif %}">
{{ block.value|jupyterize }}
</div>
{% endif %}
{% endfor %}
</section>
# definice vlastnich tagu pro templates
from django import template
register = template.Library()
@register.filter()
def jupyterize(value):
return value.value + " HIHI"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment