Tweak slides based on script changes

This commit is contained in:
Jake Howard 2024-05-17 11:02:02 +01:00
parent e4b774bd77
commit 6d94ec09e4
Signed by: jake
GPG key ID: 57AFB45680EDD477

148
slides.md
View file

@ -216,25 +216,25 @@ background: https://images.unsplash.com/photo-1522096823084-2d1aa8411c13?q=80&w=
layout: none
---
```python {all|8|9-14|16-19|all}
```python {all|18|19|10|11-16|all|18-19|all}
from django.contrib.auth.models import User
from django.core.mail import send_mail
from django.template.loader import render_to_string
import django_rq
def send_email_to_user(user: User):
email_content = render_to_string("email-template.html", {"user": user})
from wagtail.models import Page
def send_email_to_user(page: Page, user: User):
email_content = render_to_string("notification-email.html", {"user": user, "page": page})
send_mail(
subject="Here is your important customized message",
subject="A page has been published",
message=email_content
from_email=None, # Use the default sender email
recipient_list=[user.email]
)
users_to_email = User.objects.all()
for user in users_to_email.iterator():
for user in page.subscribers.iterator():
django_rq.enqueue(send_email_to_user, user)
```
@ -258,41 +258,41 @@ from django.template.loader import render_to_string
import django_rq
def send_email_to_user(user: User):
email_content = render_to_string("email-template.html", {"user": user})
from wagtail.models import Page
def send_email_to_user(page: Page, user: User):
email_content = render_to_string("notification-email.html", {"user": user, "page": page})
send_mail(
subject="Here is your important customized message",
subject="A page has been published",
message=email_content
from_email=None, # Use the default sender email
recipient_list=[user.email]
)
users_to_email = User.objects.all()
for user in users_to_email.iterator():
for user in page.subscribers.iterator():
django_rq.enqueue(send_email_to_user, user)
```
```python {all|5-7,20|all}
```python {all|7-9,20|all}
from django.contrib.auth.models import User
from django.core.mail import send_mail
from django.template.loader import render_to_string
from wagtail.models import Page
from my_celery_config import app
@app.task
def send_email_to_user(user: User):
email_content = render_to_string("email-template.html", {"user": user})
def send_email_to_user(page: Page, user: User):
email_content = render_to_string("notification-email.html", {"user": user, "page": page})
send_mail(
subject="Here is your important customized message",
subject="A page has been published",
message=email_content
from_email=None, # Use the default sender email
recipient_list=[user.email]
)
users_to_email = User.objects.all()
for user in users_to_email.iterator():
for user in page.subscribers.iterator():
send_email_to_user.delay(user)
```
````
@ -311,16 +311,6 @@ layout: fact
}
</style>
---
layout: image-right
image: https://images.unsplash.com/photo-1674027444485-cec3da58eef4?q=80&w=1932&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D
class: flex items-center text-2xl
---
- Application developers
- Library maintainers
- System Engineers
---
layout: image
image: /ridiculous.png
@ -333,7 +323,7 @@ class: bg-top!
layout: fact
---
## Introducing:{.mb-5}
## Introducing*:{.mb-5}
# `django.tasks`*
@ -346,7 +336,20 @@ layout: fact
/>
</div>
---
layout: image-right
image: https://images.unsplash.com/photo-1674027444485-cec3da58eef4?q=80&w=1932&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D
class: flex items-center text-xl
---
- API contract between library and application developers
- Swappable backends through `settings.py`
- Built in backends:
- ORM
- "Immediate"
- "Dummy"
- Django 5.2 🤞
- Backport for 4.2+
---
layout: center
---
@ -357,44 +360,44 @@ from django.contrib.auth.models import User
from django.core.mail import send_mail
from django.template.loader import render_to_string
from wagtail.models import Page
from my_celery_config import app
@app.task
def send_email_to_user(user: User):
email_content = render_to_string("email-template.html", {"user": user})
def send_email_to_user(page: Page, user: User):
email_content = render_to_string("notification-email.html", {"user": user, "page": page})
send_mail(
subject="Here is your important customized message",
subject="A page has been published",
message=email_content
from_email=None, # Use the default sender email
recipient_list=[user.email]
)
users_to_email = User.objects.all()
for user in users_to_email.iterator():
for user in page.subscribers.iterator():
send_email_to_user.delay(user)
```
```python {all|5-7,20|all}
```python {all|7-9,20|all}
from django.contrib.auth.models import User
from django.core.mail import send_mail
from django.template.loader import render_to_string
from wagtail.models import Page
from django.tasks import task
@task()
def send_email_to_user(user: User):
email_content = render_to_string("email-template.html", {"user": user})
def send_email_to_user(page: Page, user: User):
email_content = render_to_string("notification-email.html", {"user": user, "page": page})
send_mail(
subject="Here is your important customized message",
subject="A page has been published",
message=email_content
from_email=None, # Use the default sender email
recipient_list=[user.email]
)
users_to_email = User.objects.all()
for user in users_to_email.iterator():
for user in page.subscribers.iterator():
send_email_to_user.enqueue(user)
```
````
@ -408,13 +411,11 @@ from django.contrib.auth.models import User
from django.core.mail import send_mail
from django.template.loader import render_to_string
users_to_email = User.objects.all()
email_content = render_to_string("email-template.html", {"page": page})
email_content = render_to_string("email-template.html")
for user in users_to_email.iterator():
for user in page.subscribers.iterator():
send_mail(
subject="Here is your important message",
subject="The page has changed",
message=email_content
from_email=None, # Use the default sender email
recipient_list=[user.email]
@ -441,33 +442,51 @@ class: flex justify-center text-2xl flex-col
<v-click>
### A: We're not
### A: It doesn't have to be
</v-click>
---
layout: center
layout: image-right
image: https://images.unsplash.com/photo-1525683879097-8babce1c602a?q=80&w=1335&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D
class: flex justify-center text-2xl flex-col
---
# Why something built-in?
<Transform :scale="1.3">
# Q: Why something built-in?
- Improve interoperability
- Reduce cognitive load
- Reduce barrier to entry
</Transform>
---
layout: center
transition: fade
---
![](/postgres.png){.max-h-48.mx-auto}
## vs
![](https://docs.celeryq.dev/en/stable/_static/celery_512.png){.max-h-32.mx-auto}
<style>
.slidev-layout {
background: white;
color: black;
text-align: center;
}
</style>
---
layout: center
---
![](/elasticsearch.png){.max-h-32.mx-auto}
![](/postgres.png){.max-h-48.mx-auto}
## vs
![](/postgres.png){.max-h-48.mx-auto}
![](/elasticsearch.png){.max-h-32.mx-auto}
<style>
@ -490,6 +509,12 @@ layout: section
</v-click>
---
layout: section
---
# Where will we be soon™?
---
layout: cover
background: https://docs.celeryq.dev/en/stable/_static/celery_512.png
@ -521,6 +546,13 @@ class: flex justify-center flex-col text-xl
- Task timeouts
- Swappable argument serialization
---
layout: cover
background: https://images.unsplash.com/photo-1519187903022-c0055ec4036a?q=80&w=1335&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D
---
# The future is bright
---
layout: section
---
@ -531,7 +563,7 @@ layout: section
layout: end
---
END
QUESTIONS?
<div class="absolute right-1/2 bottom-4 translate-x-1/2">
<QRCode