diff --git a/slides.md b/slides.md
index 3469640..6ce94cc 100644
--- a/slides.md
+++ b/slides.md
@@ -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
}
----
-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
/>
+---
+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
-### A: We're not
+### A: It doesn't have to be
---
-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?
-
-
+# Q: Why something built-in?
- Improve interoperability
- Reduce cognitive load
- Reduce barrier to entry
-
+---
+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}
+
+
+
---
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}