1
Fork 0

Bootstrap some skeleton slides

This commit is contained in:
Jake Howard 2024-04-05 18:01:50 +01:00
parent 28d1a227f7
commit dd714e59e4
Signed by: jake
GPG key ID: 57AFB45680EDD477
4 changed files with 8461 additions and 0 deletions

8286
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

15
package.json Normal file
View file

@ -0,0 +1,15 @@
{
"name": "recovering-deleted-wagtail-pages",
"type": "module",
"private": true,
"scripts": {
"build": "slidev build",
"start": "slidev",
"export": "slidev export"
},
"dependencies": {
"@slidev/cli": "^0.48.8",
"@slidev/theme-default": "latest",
"vue": "^3.4.21"
}
}

10
setup/shiki.ts Normal file
View file

@ -0,0 +1,10 @@
import { defineShikiSetup } from '@slidev/types'
export default defineShikiSetup(() => {
return {
themes: {
dark: 'github-dark',
light: 'github-light',
},
}
})

150
slides.md Normal file
View file

@ -0,0 +1,150 @@
---
title: Recovering deleted Wagtail pages and Django models
class: text-center
highlighter: shiki
transition: slide-left
---
# Recovering deleted Wagtail pages and Django models
### Jake Howard
###### Senior Systems Engineer @ Torchbox
###### Security Team @ Wagtail
###### Performance Working Group @ Wagtail
---
layout: cover
background: https://cdn.jsdelivr.net/gh/wagtail/wagtail@main/.github/wagtail-screenshot-with-browser.png
---
# Setting the scene
---
layout: cover
---
# Site history report
---
layout: cover
---
# Restoring from backups
---
layout: cover
---
# _Partial_ restores from backups
---
layout: center
---
# 1. Spin up a database backup
---
layout: center
---
<style>
pre.shiki {
font-size: 1.4rem;
}
</style>
# 2. Locate the page models
<div class="pt-5">
```python
from wagtail.models import Page
sysadmin_page = Page.objects.get(id=91)
child_pages = sysadmin_page.get_descendants()
```
</div>
---
layout: center
---
<style>
pre.shiki {
font-size: 1.4rem;
}
</style>
# 3. Locate what was deleted
<div class="pt-5">
```python
from django.contrib.admin.utils import NestedObjects
collector = NestedObjects()
collector.collect(list(child_pages) + [sysadmin_page])
```
</div>
---
layout: center
---
<style>
pre.shiki {
font-size: 1.4rem;
}
</style>
# 4. Serialize
<div class="pt-5">
```python
from django.core import serializers
class NoM2MSerializer(Serializer):
def handle_m2m_field(self, obj, field):
pass
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
)
```
</div>
---
layout: center
---
# 4a. Deserialize
---
layout: center
---
# 5. Test test test
---
layout: center
---
# 6. Showtime!
---
layout: end
---
# Conclusion