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

Feature/Html mailing #317

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Feature/Html mailing #317

wants to merge 9 commits into from

Conversation

DutcherNL
Copy link
Contributor

Added ability to use HTML templates with emails

@DutcherNL DutcherNL added emails Related to sending and receiving emails styling and layout Related to visual styling and layout (bootstrap, css, html) labels Apr 26, 2023
github-actions[bot]

This comment was marked as off-topic.

@codecov
Copy link

codecov bot commented Apr 26, 2023

Codecov Report

Patch coverage: 79.66% and project coverage change: -0.61% ⚠️

Comparison is base (ed362f0) 95.84% compared to head (1eb8228) 95.23%.
Report is 69 commits behind head on master.

❗ Current head 1eb8228 differs from pull request most recent head bd23ac8. Consider uploading reports for the commit bd23ac8 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #317      +/-   ##
==========================================
- Coverage   95.84%   95.23%   -0.61%     
==========================================
  Files         145      153       +8     
  Lines        6113     6342     +229     
  Branches      968      994      +26     
==========================================
+ Hits         5859     6040     +181     
- Misses        174      220      +46     
- Partials       80       82       +2     
Flag Coverage Δ
unittests 95.23% <79.66%> (-0.61%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
core/urls.py 100.00% <ø> (ø)
squire/urls.py 100.00% <ø> (ø)
mailing/views.py 36.76% <36.76%> (ø)
mailing/sites.py 90.00% <90.00%> (ø)
mailing/mailing.py 95.91% <95.91%> (ø)
core/forms.py 100.00% <100.00%> (ø)
core/mailing.py 100.00% <100.00%> (ø)
mailing/forms.py 100.00% <100.00%> (ø)
mailing/loaders.py 100.00% <100.00%> (ø)
mailing/templatetags/mailing_tags.py 100.00% <100.00%> (ø)
... and 2 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


class MailForm(forms.Form):
"""A simple form to construct and send_to e-mails"""
to = forms.EmailField()

Choose a reason for hiding this comment

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

[blackfmt] reported by reviewdog 🐶

Suggested change
to = forms.EmailField()
to = forms.EmailField()

Comment on lines +15 to +18
SimpleMessageEmail(
message=self.cleaned_data['text'],
subject=self.cleaned_data['subject']
).send_to([self.cleaned_data['to']])

Choose a reason for hiding this comment

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

[blackfmt] reported by reviewdog 🐶

Suggested change
SimpleMessageEmail(
message=self.cleaned_data['text'],
subject=self.cleaned_data['subject']
).send_to([self.cleaned_data['to']])
SimpleMessageEmail(message=self.cleaned_data["text"], subject=self.cleaned_data["subject"]).send_to(
[self.cleaned_data["to"]]
)

Copy link
Contributor

Choose a reason for hiding this comment

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

If you want this on multiple lines, use a comma

Renders and sends emails in a predefined template. It's basically the email alternative to the View class
:param template_name: The path and name of the template (without extention)
"""
template_name: str = None

Choose a reason for hiding this comment

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

[blackfmt] reported by reviewdog 🐶

Suggested change
template_name: str = None
template_name: str = None


def _get_mail_templates(self, extension: str):
"""Gets the mail template with the given extention"""
return get_template(f"{self.template_name}.{extension}", using='EmailTemplates')

Choose a reason for hiding this comment

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

[blackfmt] reported by reviewdog 🐶

Suggested change
return get_template(f"{self.template_name}.{extension}", using='EmailTemplates')
return get_template(f"{self.template_name}.{extension}", using="EmailTemplates")


__all__ = ["MailTestingMixin"]

class MailTestingMixin(TestCase):

Choose a reason for hiding this comment

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

[blackfmt] reported by reviewdog 🐶

Suggested change
class MailTestingMixin(TestCase):
class MailTestingMixin(TestCase):

Comment on lines 149 to 151
]
}
}

Choose a reason for hiding this comment

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

[blackfmt] reported by reviewdog 🐶

Suggested change
]
}
}
],
},
},

)
]
}
}
]

WSGI_APPLICATION = 'squire.wsgi.application'

Choose a reason for hiding this comment

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

[blackfmt] reported by reviewdog 🐶

Suggested change
WSGI_APPLICATION = 'squire.wsgi.application'
WSGI_APPLICATION = "squire.wsgi.application"

@@ -257,6 +274,9 @@
os.path.join(BASE_DIR, 'core', 'static_compiled'),

Choose a reason for hiding this comment

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

[blackfmt] reported by reviewdog 🐶

Suggested change
os.path.join(BASE_DIR, 'core', 'static_compiled'),
os.path.join(BASE_DIR, "core", "static_compiled"),

@@ -257,6 +274,9 @@
os.path.join(BASE_DIR, 'core', 'static_compiled'),
]

# Email settings
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

Choose a reason for hiding this comment

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

[blackfmt] reported by reviewdog 🐶

Suggested change
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"

@@ -257,6 +274,9 @@
os.path.join(BASE_DIR, 'core', 'static_compiled'),
]

# Email settings
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'


# The directory in which the coverage reports should be stored
COVERAGE_REPORT_DIR = os.path.join(BASE_DIR, 'coverage')

Choose a reason for hiding this comment

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

[blackfmt] reported by reviewdog 🐶

Suggested change
COVERAGE_REPORT_DIR = os.path.join(BASE_DIR, 'coverage')
COVERAGE_REPORT_DIR = os.path.join(BASE_DIR, "coverage")

github-actions[bot]

This comment was marked as off-topic.

EricTRL added a commit that referenced this pull request Sep 17, 2023
Added missing code comments.
Added global preferences for registration email footers. This should be refactored once #317 is merged.
@EricTRL EricTRL mentioned this pull request Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emails Related to sending and receiving emails styling and layout Related to visual styling and layout (bootstrap, css, html)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants