Add args attribute to move_pages and replace_text

Django no longer implicity accepts positional arguments without args being set.
See: https://docs.djangoproject.com/en/dev/releases/1.8/#management-commands-that-only-accept-positional-arguments
This commit is contained in:
Karl Hobley 2015-03-15 21:59:51 +00:00 committed by Matt Westcott
parent 944017d2c0
commit 11a95a4948
2 changed files with 4 additions and 0 deletions

View file

@ -4,6 +4,8 @@ from wagtail.wagtailcore.models import Page
class Command(BaseCommand):
args = "<from id> <to id>"
def handle(self, _from_id, _to_id, **options):
# Convert args to integers
from_id = int(_from_id)

View file

@ -20,6 +20,8 @@ def replace_in_model(model, from_text, to_text):
class Command(BaseCommand):
args = "<from text> <to text>"
def handle(self, from_text, to_text, **options):
for revision in PageRevision.objects.filter(content_json__contains=from_text):
revision.content_json = revision.content_json.replace(from_text, to_text)