Skip to content

Commit

Permalink
adhocracy4/emails: refactors send_async for use with celery workers (…
Browse files Browse the repository at this point in the history
…makes it serializable by returning nothing)
  • Loading branch information
hklarner authored and m4ra committed Sep 21, 2023
1 parent 8710f0d commit db03f34
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions adhocracy4/emails/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
def send_async(
email_module_name, email_class_name, app_label, model_name, object_pk, args, kwargs
):
imported_module = importlib.import_module(email_module_name)
cls = getattr(imported_module, email_class_name)
email_module = importlib.import_module(email_module_name)
email_class = getattr(email_module, email_class_name)
model = apps.get_model(app_label, model_name)
obj = model.objects.get(pk=object_pk)

return cls().dispatch(obj, *args, **kwargs)
email_class().dispatch(obj, *args, **kwargs)

0 comments on commit db03f34

Please sign in to comment.