Installing Wagtail

Wagtail has become a very popular CMS in the last year. Start with this video to see how to get it up and running for your project, and get content on the homepage.
Download HD Version next video: reverse, lazy and resolve - Django url-resolvers

resources

Wagtail

pip install wagtail

wagtail start demo

vim demo/settings/base.py

./manage.py migrate

./manage.py createsuperuser

home/models.py

from __future__ import unicode_literals

from django.db import models

from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailadmin.edit_handlers import FieldPanel


class HomePage(Page):
    summary = models.CharField(max_length=140, default='')
    body = RichTextField(blank=True)

    content_panels = Page.content_panels + [
        FieldPanel('summary', classname='full'),
        FieldPanel('body', classname="full"),
    ]
./manage.py makemigrations
./manage.py migrate

home/templates/home/home_page.html

{% extends "base.html" %}

{% load wagtailcore_tags %}

{% block body_class %}template-homepage{% endblock %}

{% block content %}
    <div>
        <h2>Content</h2>
        {{ page.body|richtext }}
    </div>
    <div>
        <h3>Tweet This</h3>
        {{ page.summary }}
    </div>
{% endblock %}
comments powered by Disqus