This commit is contained in:
zandercymatics 2024-05-24 13:38:26 -06:00
parent 6342f63596
commit 5c1e41bb55
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 6 additions and 3 deletions

View file

@ -2309,6 +2309,7 @@ class UserGroupAdmin(AuditedAdmin):
class WaffleFlagAdmin(FlagAdmin):
"""Custom admin implementation of django-waffle's Flag class"""
class Meta:
"""Contains meta information about this class"""
@ -2318,12 +2319,14 @@ class WaffleFlagAdmin(FlagAdmin):
class WaffleSwitchAdmin(SwitchAdmin):
"""Custom admin implementation of django-waffle's Switch class"""
class Meta:
"""Contains meta information about this class"""
model = models.WaffleSwitch
fields = "__all__"
admin.site.unregister(LogEntry) # Unregister the default registration
admin.site.register(LogEntry, CustomLogEntryAdmin)

View file

@ -15,4 +15,4 @@ class WaffleSwitch(AbstractBaseSwitch):
"""Contains meta information about this class"""
verbose_name = "waffle switch"
verbose_name_plural = "Waffle switches"
verbose_name_plural = "Waffle switches"

View file

@ -9,7 +9,6 @@ from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from waffle import switch_is_active
from django.conf import settings
logger = logging.getLogger(__name__)
@ -38,7 +37,8 @@ def send_templated_email(
Raises EmailSendingError if SES client could not be accessed
"""
if switch_is_active("disable_email_sending") and not settings.IS_PRODUCTION:
raise EmailSendingError("Could not send email. Email sending is disabled due to switch 'disable_email_sending'.")
message = "Could not send email. Email sending is disabled due to switch 'disable_email_sending'."
raise EmailSendingError(message)
template = get_template(template_name)
email_body = template.render(context=context)