paperwork: Use shop lead flag for certification emails

This commit is contained in:
Adam Goldsmith 2023-01-31 18:58:22 -05:00
parent d3eb890e89
commit 1dd4825a99

View File

@ -8,8 +8,6 @@ from django.template import loader
from markdownify import markdownify from markdownify import markdownify
import mdformat import mdformat
from membershipworks.models import Member
def make_multipart_email(subject, html_body, to): def make_multipart_email(subject, html_body, to):
plain_body = mdformat.text(markdownify(html_body), extensions={"tables"}) plain_body = mdformat.text(markdownify(html_body), extensions={"tables"})
@ -28,9 +26,9 @@ def make_multipart_email(subject, html_body, to):
def make_department_email(department, certifications): def make_department_email(department, certifications):
template = loader.get_template("paperwork/email/department_certifications.dj.html") template = loader.get_template("paperwork/email/department_certifications.dj.html")
shop_leads = Member.objects.filter( shop_leads = department.shop_lead_flag.members.values_list(
flags__type="label", flags__name="Shop Lead: " + department "first_name", "account_name", "email", named=True
).values_list("first_name", "account_name", "email", named=True) )
html_body = template.render( html_body = template.render(
{ {