mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-01 20:14:55 +00:00
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:
parent
944017d2c0
commit
11a95a4948
2 changed files with 4 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue