-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add permission request form for non admin
- Loading branch information
Showing
14 changed files
with
527 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
""" | ||
GeoSight is UNICEF's geospatial web-based business intelligence platform. | ||
Contact : [email protected] | ||
.. note:: This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
""" | ||
__author__ = '[email protected]' | ||
__date__ = '26/07/2023' | ||
__copyright__ = ('Copyright 2023, Unicef') | ||
|
||
from django.conf import settings | ||
from django.core.mail import send_mail | ||
from django.template.loader import render_to_string | ||
|
||
from core.models.preferences import SitePreferences | ||
|
||
|
||
def send_email_with_html( | ||
subject: str, recipient_list: list, context: dict, html_path: str | ||
): | ||
"""Send email with html.""" | ||
message = render_to_string( | ||
html_path, | ||
context | ||
) | ||
send_mail( | ||
subject, | ||
None, | ||
settings.DEFAULT_FROM_EMAIL, | ||
recipient_list, | ||
html_message=message, | ||
fail_silently=False | ||
) | ||
|
||
|
||
def send_email_to_admins_with_html( | ||
subject: str, context: dict, html_path: str | ||
): | ||
"""Send email to admins.""" | ||
admin_emails = SitePreferences.preferences().default_admin_emails | ||
if not admin_emails: | ||
return | ||
send_email_with_html(subject, admin_emails, context, html_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.