diff options
author | Jonathan DeMasi <jonathan.demasi@colorado.edu> | 2020-03-06 00:25:31 -0700 |
---|---|---|
committer | Jonathan DeMasi <jonathan.demasi@colorado.edu> | 2020-03-06 00:25:31 -0700 |
commit | bf0aa252851d58576ff6df557dc173257c8a4250 (patch) | |
tree | 5dd66779ea2a06feb30811180c456780713ab569 /blog | |
parent | 235342bf086c91c27b8f3e607112e7ae0065835b (diff) | |
download | jthanio-bf0aa252851d58576ff6df557dc173257c8a4250.tar jthanio-bf0aa252851d58576ff6df557dc173257c8a4250.tar.gz jthanio-bf0aa252851d58576ff6df557dc173257c8a4250.tar.bz2 jthanio-bf0aa252851d58576ff6df557dc173257c8a4250.tar.lz jthanio-bf0aa252851d58576ff6df557dc173257c8a4250.tar.xz jthanio-bf0aa252851d58576ff6df557dc173257c8a4250.tar.zst jthanio-bf0aa252851d58576ff6df557dc173257c8a4250.zip |
CODE BLOCKS BABY!
Diffstat (limited to 'blog')
-rw-r--r-- | blog/migrations/0009_auto_20200306_0713.py | 23 | ||||
-rw-r--r-- | blog/models.py | 2 | ||||
-rw-r--r-- | blog/templates/blog/blog_post.html | 8 |
3 files changed, 33 insertions, 0 deletions
diff --git a/blog/migrations/0009_auto_20200306_0713.py b/blog/migrations/0009_auto_20200306_0713.py new file mode 100644 index 0000000..a718592 --- /dev/null +++ b/blog/migrations/0009_auto_20200306_0713.py @@ -0,0 +1,23 @@ +# Generated by Django 3.0.3 on 2020-03-06 07:13 + +from django.db import migrations +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', '0008_auto_20200306_0703'), + ] + + 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'))]), + ), + ] diff --git a/blog/models.py b/blog/models.py index ab9f381..5ce14e4 100644 --- a/blog/models.py +++ b/blog/models.py @@ -9,6 +9,7 @@ from wagtail.documents.blocks import DocumentChooserBlock from wagtail.embeds.blocks import EmbedBlock from wagtail.images.blocks import ImageChooserBlock from wagtail.core import blocks +from wagtailcodeblock.blocks import CodeBlock from modelcluster.fields import ParentalKey, ParentalManyToManyField from modelcluster.contrib.taggit import ClusterTaggableManager @@ -51,6 +52,7 @@ class BlogPost(Page): ('document', DocumentChooserBlock()), ('media', EmbedBlock()), ('html', blocks.RawHTMLBlock(label='Raw HTML')), + ('code', CodeBlock(label='Code')), ]) tags = ClusterTaggableManager(through=BlogPostTag, blank=True) categories = ParentalManyToManyField('blog.BlogCategory', blank=True) diff --git a/blog/templates/blog/blog_post.html b/blog/templates/blog/blog_post.html index 8d4ac63..1422c6f 100644 --- a/blog/templates/blog/blog_post.html +++ b/blog/templates/blog/blog_post.html @@ -1,11 +1,19 @@ {% extends "base.html" %} +{% load static %} {% load wagtailcore_tags %} {% load wagtailcore_tags wagtailimages_tags %} {% block body_class %}template-blogpage{% endblock %} +{% block extra_css %} +<link rel="stylesheet" type="text/css" href="{% static 'css/prism.css' %}"> +{% endblock %} +{% block extra_js %} +<script type="text/javascript" src="{% static 'js/prism.js' %}"></script> +{% endblock %} {% block content %} + <div class="container"> <div class="row"> |