Skip to content
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

Allow empty from_email param #131

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

tuliolages
Copy link
Contributor

Resolves #97

The context and recipient_listparams also had to be set as default=None otherwise it wouldn't be possible to set from_email=None.

It doesn't change the order of the params, so it's not a breaking change.

It also removes the empty context params {} which are not required anymore.

@tuliolages tuliolages requested a review from fjsj June 18, 2021 20:06
cc=None, bcc=None, headers=None,
template_prefix=None, template_suffix=None,
template_dir=None, file_extension=None,
attachments=None, create_link=False):

from_email = from_email or settings.DEFAULT_FROM_EMAIL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have also a TEMPLATED_EMAIL_FROM_EMAIL setting.
A user thought this was a default. See: #97 (comment)

So I think this should read: from_email = from_email or settings.TEMPLATED_EMAIL_FROM_EMAIL or settings.DEFAULT_FROM_EMAIL

Also, check again the README, see if this is well explained. And check where TEMPLATED_EMAIL_FROM_EMAIL is being used.

Copy link
Contributor Author

@tuliolages tuliolages Jun 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I've seen, this TEMPLATED_EMAIL_FROM_EMAIL is used only by the Class-based mixin. It's documentation is written here. While it's not saying explicitly that the setting is not required, it does not specify that it'll fall back to DEFAULT_FROM_MAIL. I think this could be updated.

I'm not sure, however, if we should put it as a default in the vanilla-django file, since this class-based mixin is like a wrapper over the vanilla and the docs specific that this setting is used only by the class-based view approach.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should make the backend use this setting TEMPLATED_EMAIL_FROM_EMAIL. So from_email = from_email or settings.TEMPLATED_EMAIL_FROM_EMAIL or settings.DEFAULT_FROM_EMAIL seems fine for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fjsj I've updated the vanilla backend and added a note about this behavior in the readme.

Copy link
Member

@fjsj fjsj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check comments

@coveralls
Copy link

coveralls commented Jun 18, 2021

Coverage Status

Coverage increased (+0.03%) to 96.761% when pulling 70692db on feat/allow-empty-from_email-param into 9a3385b on develop.

README.rst Show resolved Hide resolved
…ROM_EMAIL if no email_from is passed as an arg
@@ -313,7 +313,7 @@ Attributes:
**templated_email_send_on_failure** (default: False):
This attribute tells django-templated-email to send an email if the form is invalid.

**templated_email_from_email** (default: **settings.TEMPLATED_EMAIL_FROM_EMAIL**):
**templated_email_from_email** (default: **settings.TEMPLATED_EMAIL_FROM_EMAIL**. If it's also not defined, falls back to **DEFAULT_FROM_EMAIL**):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to add a section with all the available settings and their descriptions. Check the ones mentioned in README, check the ones used in code, and add a new section to README above "Class Based Views" section.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Then I think this overrides list can be removed to concentrate the params in one place.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This specific list should be kept because it's the params of the CBV.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I've misread your previous text. Ignore my suggestion.

Copy link
Member

@fjsj fjsj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check my last comment. Overall looking great, thanks for the effort here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

from_email should accept None and set DEFAULT_FROM_EMAIL in that case
3 participants