This file contains 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 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
from wagtail.core.models import Page | |
class YourPage(Page): | |
"""Your Wagtail Page Type.""" | |
template = "templates/home_page.html" | |
@classmethod | |
def can_create_at(cls, parent): |
This file contains 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
from wagtail.core.models import Page | |
class YourPage(Page): | |
"""Your Wagtail Page Type.""" | |
template = "templates/your_page.html" | |
# Other Page fields | |
This file contains 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
#site_settings/models.py | |
from django.db import models | |
from wagtail.admin.edit_handlers import FieldPanel, MultiFieldPanel | |
from wagtail.contrib.settings.models import BaseSetting, register_setting | |
@register_setting | |
class SocialMediaSettings(BaseSetting): | |
"""Social media settings for our custom website.""" |
This file contains 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
from django.core.exceptions import ValidationError | |
from django.forms.utils import ErrorList | |
from wagtail.core import blocks | |
class CTABlock(blocks.StructBlock): | |
"""A simple call to action section.""" | |
button_url = blocks.URLBlock(required=False) |
This file contains 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
from wagtail.core.models import Page | |
from wagtail.core import blocks | |
from wagtail.images.blocks import ImageChooserBlock | |
class NestedSidebarContent(blocks.StructBlock): | |
sidebar_alignment = blocks.ChoiceBlock(choices=( | |
("left", "Left"), | |
("right", "Right"), | |
)) | |
main_content2 = blocks.StreamBlock([ |
This file contains 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
# blog/models.py | |
# Nothing in this class has changed. I just put it here for reference. | |
class BlogAuthor(models.Model): | |
"""Blog author for snippets.""" | |
name = models.CharField(max_length=100) | |
website = models.URLField(blank=True, null=True) | |
image = models.ForeignKey( | |
"wagtailimages.Image", |
This file contains 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
# dev.py | |
INSTALLED_APPS = INSTALLED_APPS + [ | |
# ... | |
'wagtail.contrib.styleguide', | |
# ... | |
] |
NewerOlder