This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# home/models.py | |
from django.db import models | |
from modelcluster.fields import ParentalKey | |
from wagtail.admin.edit_handlers import ( | |
FieldPanel, | |
MultiFieldPanel, | |
InlinePanel, | |
StreamFieldPanel, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# flex/models.py | |
"""Flexible page.""" | |
from django.db import models | |
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel | |
from wagtail.core.fields import StreamField | |
from wagtail.core.models import Page | |
from streams import blocks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# demo/blocks.py; or sterams/blocks.py | |
"""Stream Blocks.""" | |
from wagtail.core import blocks | |
class CustomRichTextBlock(blocks.StructBlock): | |
"""Rich text content.""" | |
richtext_content = blocks.RichTextBlock(required=True) | |
bg_color = blocks.ChoiceBlock(required=True, choices=[ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# templates/blog/blog_post_page.html #} | |
{% extends 'base.html' %} | |
{% load wagtailcore_tags %} | |
{% block content %} | |
{{ self.richtext|richtext }} | |
{% endblock content %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$name = (isset($_POST['name']) ? $_POST['name'] : ''); | |
$email = (isset($_POST['email']) ? $_POST['email'] : ''); | |
$password = (isset($_POST['password']) ? $_POST['password'] : ''); | |
$notification = '' | |
if( ! empty ( $name ) && !empty ( $email ) && ! empty( $password) ) { | |
$notification = "<div class='alert alert-success' role='alert'> | |
<h4 class='alert-heading'>Well done!</h4> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On Ubuntu run `sudo apt-get install nginx-extras` for perl scripts to run | |
# `sudo service nginx restart` (verify it restarted properly) | |
# Add nginx.conf perl function; add yoursite.conf location |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
"""Blog app models.""" | |
from django.db import models | |
from django.utils import timezone | |
from wagtail.admin.edit_handlers import FieldPanel | |
from wagtail.core.fields import RichTextField, StreamField | |
from wagtail.core.models import Page | |
from wagtail.images.models import Image | |
from wagtail.search import index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Register a custom Wagtail Snippet.""" | |
from django.db import models | |
from wagtail.admin.edit_handlers import FieldPanel | |
from wagtail.snippets.models import register_snippet | |
class Category(models.Model): | |
"""Category information.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Custom Page model(s).""" | |
from wagtail.wagtailadmin.edit_handlers import FieldPanel, MultiFieldPanel, StreamFieldPanel | |
from wagtail.wagtailcore.fields import StreamField | |
from wagtail.wagtailcore.models import Page | |
from wagtail.wagtailsearch import index | |
from .streamfields import * # Replace * with the streamfields you want to use | |