1
Fork 0

Tweak slides

This commit is contained in:
Jake Howard 2024-05-10 17:53:24 +01:00
parent ad153a1edf
commit 9fb2bfbeb9
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 84 additions and 30 deletions

BIN
public/red-button.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

114
slides.md
View file

@ -38,34 +38,30 @@ layout: cover
# Site history report # Site history report
--- ---
layout: cover layout: section
--- ---
# Restoring from backups # Restoring from backups
--- ---
layout: cover layout: section
--- ---
# _Partial_ restores from backups # _Partial_ restores from backups
--- ---
layout: center layout: section
--- ---
# 1. Spin up a database backup ## 1.
# Spin up a database backup
--- ---
layout: center layout: section
--- ---
<style> ## 2.
pre.shiki { # Locate the page models
font-size: 1.4rem;
}
</style>
# 2. Locate the page models
<div class="pt-5"> <div class="pt-5">
@ -79,17 +75,19 @@ child_pages = sysadmin_page.get_descendants()
</div> </div>
---
layout: center
---
<style> <style>
pre.shiki { pre.shiki {
font-size: 1.4rem; font-size: 1.4rem !important;
text-align: left;
} }
</style> </style>
# 3. Locate what was deleted ---
layout: section
---
## 3.
# Locate what was deleted
<div class="pt-5"> <div class="pt-5">
@ -102,16 +100,18 @@ collector.collect(list(child_pages) + [sysadmin_page])
</div> </div>
---
layout: center
---
<style> <style>
pre.shiki { pre.shiki {
font-size: 1.4rem; font-size: 1.4rem !important;
text-align: left;
} }
</style> </style>
---
layout: section
---
# 4. Serialize # 4. Serialize
<div class="pt-5"> <div class="pt-5">
@ -136,26 +136,80 @@ with open("deleted-models.json", "w") as f:
</div> </div>
<style>
pre.shiki {
font-size: 1rem !important;
text-align: left;
}
</style>
--- ---
layout: center layout: section
--- ---
# 4a. Deserialize ## 4a.
# Deserialize
--- ---
layout: center 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 layout: end
--- ---
# Conclusion