diff --git a/public/red-button.png b/public/red-button.png new file mode 100644 index 0000000..83928fa Binary files /dev/null and b/public/red-button.png differ diff --git a/slides.md b/slides.md index b907aee..337cdbe 100644 --- a/slides.md +++ b/slides.md @@ -38,34 +38,30 @@ layout: cover # Site history report --- -layout: cover +layout: section --- # Restoring from backups --- -layout: cover +layout: section --- # _Partial_ restores from backups --- -layout: center +layout: section --- -# 1. Spin up a database backup +## 1. +# Spin up a database backup --- -layout: center +layout: section --- - - -# 2. Locate the page models +## 2. +# Locate the page models
@@ -79,17 +75,19 @@ child_pages = sysadmin_page.get_descendants()
---- -layout: center ---- - -# 3. Locate what was deleted +--- +layout: section +--- + +## 3. +# Locate what was deleted
@@ -102,16 +100,18 @@ collector.collect(list(child_pages) + [sysadmin_page])
---- -layout: center ---- - + +--- +layout: section +--- + # 4. Serialize
@@ -136,26 +136,80 @@ with open("deleted-models.json", "w") as f:
+ + + --- -layout: center +layout: section --- -# 4a. Deserialize +## 4a. +# Deserialize --- layout: center --- -# 5. Test test test +# `restore-deleted-pages.py` + +```python {all}{lines:true} +from django.contrib.admin.utils import NestedObjects +from django.core import serializers + +from wagtail.models import Page + +class NoM2MSerializer(Serializer): + def handle_m2m_field(self, obj, field): + pass + +sysadmin_page = Page.objects.get(id=91) + +child_pages = sysadmin_page.get_descendants() + +collector = NestedObjects() +collector.collect(list(child_pages) + [sysadmin_page]) + +def get_model_instances(): + for qs in collector.data.values(): + yield from qs + +with open("deleted-models.json", "w") as f: + NoM2MSerializer().serialize( + get_model_instances(), + stream=f + ) +``` --- -layout: center +layout: section --- -# 6. Showtime! +#### 5. +### Test +## Test +# **Test!** + +--- +layout: image-right +image: /red-button.png +class: flex justify-center flex-col items-center +--- + +### 6. +# Showtime! + +--- +layout: cover +background: https://cdn.jsdelivr.net/gh/wagtail/wagtail@main/.github/wagtail-screenshot-with-browser.png +--- + +# Conclusion --- layout: end --- - -# Conclusion