diff --git a/dumpdata.sh b/dumpdata.sh new file mode 100755 index 000000000..dc08f434e --- /dev/null +++ b/dumpdata.sh @@ -0,0 +1 @@ +./manage.py dumpdata --format yaml -e auth.user -e wagtailcore.revision -e wagtailcore.referenceindex -e wagtailsearch.indexentry -e newsletter.newsletteremailaddress -e images.wagtailiorendition -e wagtailsearchpromotions.query -e wagtailsearchpromotions.querydailyhits -e wagtailcore.pagelogentry -e sessions.session -e packages.package -e packages.grid -e wagtailredirects.redirect -e wagtailcore.pagesubscription -e wagtailcore.pageviewrestriction -e wagtailcore.grouppagepermission -e wagtailcore.modellogentry > wagtailio/core/fixtures/initial_data.yaml diff --git a/wagtailio/core/management/__init__.py b/wagtailio/core/management/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/wagtailio/core/management/commands/__init__.py b/wagtailio/core/management/commands/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/wagtailio/core/management/commands/load_initial_data.py b/wagtailio/core/management/commands/load_initial_data.py new file mode 100644 index 000000000..8fb11b3f1 --- /dev/null +++ b/wagtailio/core/management/commands/load_initial_data.py @@ -0,0 +1,22 @@ +from django.contrib.auth.models import Group, Permission +from django.contrib.contenttypes.models import ContentType +from django.core.management import call_command +from django.core.management.base import BaseCommand +from django.db import transaction + +from wagtail.models import Page, Site + + +class Command(BaseCommand): + help = "Load initial data for the Wagtail.org project" + + @transaction.atomic + def handle(self, *args, **options): + Site.objects.all().delete() + Page.objects.all().delete() + Permission.objects.all().delete() + Group.objects.all().delete() + ContentType.objects.all().delete() + + call_command("loaddata", "initial_data") + self.stdout.write(self.style.SUCCESS("Successfully loaded initial data"))