diff --git a/wagtail/project_template/project_name/home/__init__.py b/wagtail/project_template/project_name/home/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/wagtail/project_template/project_name/home/migrations/0001_initial.py b/wagtail/project_template/project_name/home/migrations/0001_initial.py new file mode 100644 index 0000000000..77e0625d7a --- /dev/null +++ b/wagtail/project_template/project_name/home/migrations/0001_initial.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '__latest__'), + ] + + operations = [ + migrations.CreateModel( + name='HomePage', + fields=[ + ('page_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + ] diff --git a/wagtail/project_template/project_name/home/migrations/0002_create_homepage.py b/wagtail/project_template/project_name/home/migrations/0002_create_homepage.py new file mode 100644 index 0000000000..353fc9362c --- /dev/null +++ b/wagtail/project_template/project_name/home/migrations/0002_create_homepage.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +def create_homepage(apps, schema_editor): + # Get models + ContentType = apps.get_model('contenttypes.ContentType') + Page = apps.get_model('wagtailcore.Page') + Site = apps.get_model('wagtailcore.Site') + HomePage = apps.get_model('home.HomePage') + + # Delete the default homepage + Page.objects.get(id=2).delete() + + # Create content type for homepage model + homepage_content_type, created = ContentType.objects.get_or_create( + model='homepage', app_label='home') + + # Create a new homepage + homepage = HomePage.objects.create( + title="Homepage", + slug='home', + content_type=homepage_content_type, + path='00010001', + depth=2, + numchild=0, + url_path='/home/', + ) + + # Create a site with the new homepage set as the root + Site.objects.create( + hostname='localhost', root_page=homepage, is_default_site=True) + + +class Migration(migrations.Migration): + + dependencies = [ + ('home', '0001_initial'), + ] + + operations = [ + migrations.RunPython(create_homepage), + ] diff --git a/wagtail/project_template/project_name/home/migrations/__init__.py b/wagtail/project_template/project_name/home/migrations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/wagtail/project_template/project_name/home/models.py b/wagtail/project_template/project_name/home/models.py new file mode 100644 index 0000000000..e8278e793e --- /dev/null +++ b/wagtail/project_template/project_name/home/models.py @@ -0,0 +1,9 @@ +from __future__ import unicode_literals + +from django.db import models + +from wagtail.wagtailcore.models import Page + + +class HomePage(Page): + pass diff --git a/wagtail/project_template/project_name/home/templates/home/home_page.html b/wagtail/project_template/project_name/home/templates/home/home_page.html new file mode 100644 index 0000000000..ff860c82bb --- /dev/null +++ b/wagtail/project_template/project_name/home/templates/home/home_page.html @@ -0,0 +1,11 @@ +{% templatetag openblock %} extends "base.html" {% templatetag closeblock %} + +{% templatetag openblock %} block body_class {% templatetag closeblock %}template-{% templatetag openvariable %} self.get_verbose_name|slugify {% templatetag closevariable %}{% templatetag openblock %} endblock {% templatetag closeblock %} + +{% templatetag openblock %} block content {% templatetag closeblock %} +

Welcome to your new Wagtail site!

+ +

You can access the admin interface here (make sure you have run "./manage.py createsuperuser" in the console first). + +

If you haven't already given the documentation a read, head over to http://wagtail.readthedocs.org to start building on Wagtail

+{% templatetag openblock %} endblock {% templatetag closeblock %} diff --git a/wagtail/project_template/project_name/settings/base.py b/wagtail/project_template/project_name/settings/base.py index 85f9637f24..f3e92f68d7 100644 --- a/wagtail/project_template/project_name/settings/base.py +++ b/wagtail/project_template/project_name/settings/base.py @@ -46,6 +46,8 @@ INSTALLED_APPS = ( 'wagtail.wagtailembeds', 'wagtail.wagtailredirects', 'wagtail.wagtailforms', + + '{{ project_name }}.home', ) MIDDLEWARE_CLASSES = (