More email stuff.

This commit is contained in:
Víðir Valberg Guðmundsson 2019-08-08 11:09:25 +02:00
parent 4def56ad92
commit cd66b5fd5d
2 changed files with 7 additions and 2 deletions

View File

@ -3,6 +3,7 @@ from django.contrib import admin
from .models import OutgoingEmail
@admin.register(OutgoingEmail)
class OutgoingEmailAdmin(admin.ModelAdmin):
model = OutgoingEmail
fields = ['subject', 'to_recipients']
fields = ['subject', 'to_recipients']

View File

@ -71,7 +71,6 @@ def add_outgoing_email(
sender="BornHack <info@bornhack.dk>",
attachment=None,
attachment_filename="",
attachments=None,
):
""" adds an email to the outgoing queue
recipients is a list of to recipients
@ -100,4 +99,9 @@ def add_outgoing_email(
bcc_recipients=bcc_recipients,
)
if attachment:
django_file = ContentFile(attachment)
django_file.name = attachment_filename
email.attachment.save(attachment_filename, django_file, save=True)
return True