summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan DeMasi <jon.demasi@colorado.edu>2020-03-10 11:23:49 -0600
committerJonathan DeMasi <jon.demasi@colorado.edu>2020-03-10 11:23:49 -0600
commit31e35053398cc66a0c316df175b1181300625918 (patch)
tree8b555a41cef356e50938ae3da02ed2fb33a8c032
parenta941b4a520dcc2af2135b632183cc98383aca356 (diff)
downloadjthanio-31e35053398cc66a0c316df175b1181300625918.tar
jthanio-31e35053398cc66a0c316df175b1181300625918.tar.gz
jthanio-31e35053398cc66a0c316df175b1181300625918.tar.bz2
jthanio-31e35053398cc66a0c316df175b1181300625918.tar.lz
jthanio-31e35053398cc66a0c316df175b1181300625918.tar.xz
jthanio-31e35053398cc66a0c316df175b1181300625918.tar.zst
jthanio-31e35053398cc66a0c316df175b1181300625918.zip
tables working
-rw-r--r--blog/migrations/0010_auto_20200310_1719.py24
-rw-r--r--blog/models.py3
-rw-r--r--blog/templates/blog/table_template.html48
-rw-r--r--jthanio/settings/base.py1
-rw-r--r--media/images/2020-02-11-100233_1659x984_sc.2e16d0ba.fill-900x300-c100.pngbin0 -> 116180 bytes
-rw-r--r--media/images/2020-02-11-100233_1659x984_scrot.max-165x165.pngbin0 -> 10505 bytes
-rw-r--r--media/original_images/2020-02-11-100233_1659x984_scrot.pngbin0 -> 152549 bytes
7 files changed, 76 insertions, 0 deletions
diff --git a/blog/migrations/0010_auto_20200310_1719.py b/blog/migrations/0010_auto_20200310_1719.py
new file mode 100644
index 0000000..b4c8b97
--- /dev/null
+++ b/blog/migrations/0010_auto_20200310_1719.py
@@ -0,0 +1,24 @@
+# Generated by Django 3.0.4 on 2020-03-10 17:19
+
+from django.db import migrations
+import wagtail.contrib.table_block.blocks
+import wagtail.core.blocks
+import wagtail.core.fields
+import wagtail.documents.blocks
+import wagtail.embeds.blocks
+import wagtail.images.blocks
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('blog', '0009_auto_20200306_0713'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='blogpost',
+ name='body',
+ field=wagtail.core.fields.StreamField([('heading', wagtail.core.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.core.blocks.RichTextBlock()), ('image', wagtail.images.blocks.ImageChooserBlock()), ('page', wagtail.core.blocks.PageChooserBlock()), ('document', wagtail.documents.blocks.DocumentChooserBlock()), ('media', wagtail.embeds.blocks.EmbedBlock()), ('html', wagtail.core.blocks.RawHTMLBlock(label='Raw HTML')), ('code', wagtail.core.blocks.StructBlock([('language', wagtail.core.blocks.ChoiceBlock(choices=[('bash', 'Bash/Shell'), ('css', 'CSS'), ('diff', 'diff'), ('html', 'HTML'), ('javascript', 'Javascript'), ('json', 'JSON'), ('python', 'Python'), ('scss', 'SCSS'), ('yaml', 'YAML')], help_text='Coding language', identifier='language', label='Language')), ('code', wagtail.core.blocks.TextBlock(identifier='code', label='Code'))], label='Code')), ('table', wagtail.contrib.table_block.blocks.TableBlock(template='blog/table_template.html'))]),
+ ),
+ ]
diff --git a/blog/models.py b/blog/models.py
index e34ca58..03667c5 100644
--- a/blog/models.py
+++ b/blog/models.py
@@ -14,6 +14,7 @@ from wagtailcodeblock.blocks import CodeBlock
from modelcluster.fields import ParentalKey, ParentalManyToManyField
from modelcluster.contrib.taggit import ClusterTaggableManager
+from wagtail.contrib.table_block.blocks import TableBlock
from taggit.models import TaggedItemBase
from wagtail.snippets.models import register_snippet
@@ -68,6 +69,8 @@ class BlogPost(Page):
('media', EmbedBlock()),
('html', blocks.RawHTMLBlock(label='Raw HTML')),
('code', CodeBlock(label='Code')),
+ ('table', TableBlock(template="blog/table_template.html")),
+
])
tags = ClusterTaggableManager(through=BlogPostTag, blank=True)
categories = ParentalManyToManyField('blog.BlogCategory', blank=True)
diff --git a/blog/templates/blog/table_template.html b/blog/templates/blog/table_template.html
new file mode 100644
index 0000000..53081ac
--- /dev/null
+++ b/blog/templates/blog/table_template.html
@@ -0,0 +1,48 @@
+<table class="table table-hover">
+ {% if table_header %}
+ <thead>
+ <tr>
+ {% for column in table_header %}
+ <th>
+ {% if column.strip %}
+ {% if html_renderer %}
+ {{ column.strip|safe|linebreaksbr }}
+ {% else %}
+ {{ column.strip|linebreaksbr }}
+ {% endif %}
+ {% endif %}
+ </th>
+ {% endfor %}
+ </tr>
+ </thead>
+ {% endif %}
+ <tbody>
+ {% for row in data %}
+ <tr>
+ {% for column in row %}
+ {% if first_col_is_header and forloop.first %}
+ <th>
+ {% if column.strip %}
+ {% if html_renderer %}
+ {{ column.strip|safe|linebreaksbr }}
+ {% else %}
+ {{ column.strip|linebreaksbr }}
+ {% endif %}
+ {% endif %}
+ </th>
+ {% else %}
+ <td>
+ {% if column.strip %}
+ {% if html_renderer %}
+ {{ column.strip|safe|linebreaksbr }}
+ {% else %}
+ {{ column.strip|linebreaksbr }}
+ {% endif %}
+ {% endif %}
+ </td>
+ {% endif %}
+ {% endfor %}
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>
diff --git a/jthanio/settings/base.py b/jthanio/settings/base.py
index 466fd1d..2dc5b44 100644
--- a/jthanio/settings/base.py
+++ b/jthanio/settings/base.py
@@ -28,6 +28,7 @@ INSTALLED_APPS = [
'blog',
'search',
'wagtailcodeblock',
+ 'wagtail.contrib.table_block',
'wagtail.contrib.forms',
'wagtail.contrib.redirects',
'wagtail.embeds',
diff --git a/media/images/2020-02-11-100233_1659x984_sc.2e16d0ba.fill-900x300-c100.png b/media/images/2020-02-11-100233_1659x984_sc.2e16d0ba.fill-900x300-c100.png
new file mode 100644
index 0000000..1befa8e
--- /dev/null
+++ b/media/images/2020-02-11-100233_1659x984_sc.2e16d0ba.fill-900x300-c100.png
Binary files differ
diff --git a/media/images/2020-02-11-100233_1659x984_scrot.max-165x165.png b/media/images/2020-02-11-100233_1659x984_scrot.max-165x165.png
new file mode 100644
index 0000000..7c0b3dc
--- /dev/null
+++ b/media/images/2020-02-11-100233_1659x984_scrot.max-165x165.png
Binary files differ
diff --git a/media/original_images/2020-02-11-100233_1659x984_scrot.png b/media/original_images/2020-02-11-100233_1659x984_scrot.png
new file mode 100644
index 0000000..3348315
--- /dev/null
+++ b/media/original_images/2020-02-11-100233_1659x984_scrot.png
Binary files differ