-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/config mail send #183
Conversation
Codecov Report
@@ Coverage Diff @@
## master #183 +/- ##
==========================================
+ Coverage 97.42% 97.44% +0.01%
==========================================
Files 43 43
Lines 1552 1563 +11
Branches 207 208 +1
==========================================
+ Hits 1512 1523 +11
Misses 20 20
Partials 20 20
Continue to review full report at Codecov.
|
Hi @robwa, thank you for putting a lot of work and providing that PR. I have one big question about this: in case you need custom e-mail handling, why just not implement custom Django email backend (like the ones described here: https://docs.djangoproject.com/en/dev/topics/email/#email-backends)? I feel that solution would be much easier and would cover the case you're describing. BTW: I'm going on short vacation, I should be back in few days. |
Thank you for your answer and your suggestion, @apragacz. The Django email backends handle sending of emails, as far as I understand them. What we need is our own mechanism for construction of emails. I.e., we extend the Django email class, handle templates our own way and so on. See e.g. django-templated-email as an example. The PR makes it possible to use django-templated-email or any other custom email construction mechanism with django-rest-registration. One could add convenience functions for returning the signed data for a user, which is all you need from rest-registration to construct valid emails. But as I wanted to keep it as small as possible, I didn't invest into that topic. |
Thank you for clarifying that @robwa. Changes look LGTM and I'm gonna merge them soon. |
Changes: * Make email sending replaceable (#183) * Drop Django 1.x support from requirements
Checklist
make check && make test
) before submitting the PR on my branch and they passedDescription
The proposed changes make the email sending mechanism replaceable.
*_EMAIL_SENDER
likeLOGIN_AUTHENTICATOR
).BASE_URL
set.Why the change is needed?
Some apps send many emails and use their own mechanism for sending them. Of course, registration mails should be sent with the app's mechanism, so all of them can be treated the same way. Therefore one might want to replace email handling and just use the signers to pass the correct data with the emails.
Related issues, pull requests, links
Email handling might be done in signal handlers (see #56). But nevertheless the email handling of
rest_registration
would have to be disabled in this case.