Reputation: 415
How do I edit an existing Wagtail page programmatically? There's a few explanations of how to add new pages, but I still can't seem to figure out how to edit a single field on an existing page. I'd like to use the 'Title' field as reference.
This seems to be completely undocumented officially, but there is a nice written guide to adding pages programmatically here.
Upvotes: 2
Views: 972
Reputation: 11228
Wagtail is just a Django app. A big one, and it overrides some Django features. So it might be nicer to say Wagtail is built on top op Django. Anyway, Wagtail is just Django.
Wagtail content types like pages, images and documents and all your custom content types (snippets etc) are Django models. So the Django documentation on models and making queries is the documentation you are looking for.
Here is an example for setting the page title programatically:
page = Page.objects.get(id=1)
page.title = 'Some title'
page.save()
Upvotes: 2