peopledoc / django-mail-factory

Django Mail Manager
Other
72 stars 17 forks source link

Automatic email sending upon class based createview, updateview #62

Closed sunjoomoon closed 4 years ago

sunjoomoon commented 8 years ago

Following https://docs.djangoproject.com/en/1.8/topics/class-based-views/generic-editing/

views.py

from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.core.urlresolvers import reverse_lazy
from myapp.models import Author

class AuthorCreate(CreateView):
    model = Author
    fields = ['name','email']

class AuthorUpdate(UpdateView):
    model = Author
    fields = ['name','email']

class AuthorDelete(DeleteView):
    model = Author
    success_url = reverse_lazy('author-list')

I am trying to figure out how mail-factory can be used to send email to the user's 'email' field and to 'settings.MANAGERS' upon Author creation and Update. Any example or hint will be cool.

EnriqueSoria commented 4 years ago

You can use post-save django signal

ewjoachim commented 4 years ago

Hello :)

So did it work for your usecase ? If so, and you think this should be somewhere in the documentation, would you be interesting in providing a pull request and add it ? If you don't think it should be in the doc, is it OK if we close the ticket ?

Thank you :)

ewjoachim commented 4 years ago

I'll close for now but that does not mean we're not interested in feedback. If there's anything you find still needs discussing, by all means, reopen.