Format demo purge and remove demo plugins
This commit is contained in:
@@ -21,7 +21,10 @@ class PurgeStats:
|
|||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = "Remove demo pages/products from Mandel Blog while preserving idea marketplace content."
|
help = (
|
||||||
|
"Remove demo pages/products from Mandel Blog while preserving "
|
||||||
|
"idea marketplace content."
|
||||||
|
)
|
||||||
|
|
||||||
def add_arguments(self, parser):
|
def add_arguments(self, parser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@@ -47,7 +50,11 @@ class Command(BaseCommand):
|
|||||||
stats = PurgeStats(pages=page_count, products=product_count)
|
stats = PurgeStats(pages=page_count, products=product_count)
|
||||||
|
|
||||||
mode = "DRY RUN" if dry_run else "APPLIED"
|
mode = "DRY RUN" if dry_run else "APPLIED"
|
||||||
self.stdout.write(self.style.SUCCESS(f"[{mode}] Removed pages={stats.pages}, products={stats.products}"))
|
self.stdout.write(
|
||||||
|
self.style.SUCCESS(
|
||||||
|
f"[{mode}] Removed pages={stats.pages}, products={stats.products}"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def _purge_pages(self, *, dry_run: bool) -> int:
|
def _purge_pages(self, *, dry_run: bool) -> int:
|
||||||
from wagtail.models import Page
|
from wagtail.models import Page
|
||||||
@@ -87,7 +94,10 @@ class Command(BaseCommand):
|
|||||||
removed = 0
|
removed = 0
|
||||||
for page in candidates:
|
for page in candidates:
|
||||||
removed += 1
|
removed += 1
|
||||||
self.stdout.write(f"PAGE {'[dry-run] ' if dry_run else ''}delete id={page.id} slug={page.slug} title={page.title}")
|
self.stdout.write(
|
||||||
|
f"PAGE {'[dry-run] ' if dry_run else ''}delete id={page.id} "
|
||||||
|
f"slug={page.slug} title={page.title}"
|
||||||
|
)
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
page.delete()
|
page.delete()
|
||||||
return removed
|
return removed
|
||||||
@@ -105,7 +115,13 @@ class Command(BaseCommand):
|
|||||||
if keep_only_idea_products:
|
if keep_only_idea_products:
|
||||||
candidates = products.exclude(title__in=IDEA_PRODUCT_TITLES)
|
candidates = products.exclude(title__in=IDEA_PRODUCT_TITLES)
|
||||||
else:
|
else:
|
||||||
title_markers = ["demo", "sample", "placeholder", "starter website", "business website"]
|
title_markers = [
|
||||||
|
"demo",
|
||||||
|
"sample",
|
||||||
|
"placeholder",
|
||||||
|
"starter website",
|
||||||
|
"business website",
|
||||||
|
]
|
||||||
candidates = [
|
candidates = [
|
||||||
p
|
p
|
||||||
for p in products
|
for p in products
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"ocyan_plugins": [
|
"ocyan_plugins": [
|
||||||
"ocyan.plugin.contact_form",
|
"ocyan.plugin.contact_form",
|
||||||
"ocyan.plugin.cookie_jar",
|
"ocyan.plugin.cookie_jar",
|
||||||
"ocyan.plugin.demo_data",
|
|
||||||
"ocyan.plugin.django",
|
"ocyan.plugin.django",
|
||||||
"ocyan.plugin.newsletter",
|
"ocyan.plugin.newsletter",
|
||||||
"ocyan.plugin.oscar",
|
"ocyan.plugin.oscar",
|
||||||
@@ -15,7 +14,6 @@
|
|||||||
"ocyan.plugin.oscar_partner",
|
"ocyan.plugin.oscar_partner",
|
||||||
"ocyan.plugin.oscar_shipping",
|
"ocyan.plugin.oscar_shipping",
|
||||||
"ocyan.plugin.oscar_sequential_order_numbers",
|
"ocyan.plugin.oscar_sequential_order_numbers",
|
||||||
"ocyan.plugin.payment_dummy",
|
|
||||||
"ocyan.plugin.roadrunner_bs5",
|
"ocyan.plugin.roadrunner_bs5",
|
||||||
"ocyan.plugin.template_engine",
|
"ocyan.plugin.template_engine",
|
||||||
"ocyan.plugin.roadrunner_productchooser",
|
"ocyan.plugin.roadrunner_productchooser",
|
||||||
@@ -65,9 +63,6 @@
|
|||||||
"en"
|
"en"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ocyan_dummy_payment_plugin": {
|
|
||||||
"help_text": "Hit pay, to simulate payment."
|
|
||||||
},
|
|
||||||
"oscar": {
|
"oscar": {
|
||||||
"allow_anon_checkout": true,
|
"allow_anon_checkout": true,
|
||||||
"cancelled_order_status": "cancelled",
|
"cancelled_order_status": "cancelled",
|
||||||
|
|||||||
Reference in New Issue
Block a user