[paperwork] Send admin cert emails to specific permission, not all staff
Closes #2
This commit is contained in:
parent
485c4f0806
commit
5ea485abf0
@ -87,10 +87,11 @@ def admin_email(ordered_queryset):
|
||||
return make_multipart_email(
|
||||
f"{len(ordered_queryset)} new CMS Certifications issued",
|
||||
html_body,
|
||||
# TODO: Admin emails should probably be from a group, not all staff
|
||||
to=(
|
||||
get_user_model()
|
||||
.objects.filter(is_staff=True)
|
||||
.objects.with_perm(
|
||||
"paperwork.receive_certification_emails", include_superusers=False
|
||||
)
|
||||
.values_list("email", flat=True)
|
||||
),
|
||||
)
|
||||
|
24
paperwork/migrations/0004_alter_certification_options.py
Normal file
24
paperwork/migrations/0004_alter_certification_options.py
Normal file
@ -0,0 +1,24 @@
|
||||
# Generated by Django 4.0.2 on 2022-03-11 20:28
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("paperwork", "0003_alter_certificationversion_id"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name="certification",
|
||||
options={
|
||||
"permissions": [
|
||||
(
|
||||
"receive_certification_emails",
|
||||
"Receives notifications of all new certifications",
|
||||
)
|
||||
]
|
||||
},
|
||||
),
|
||||
]
|
@ -109,6 +109,12 @@ class Certification(models.Model):
|
||||
|
||||
class Meta:
|
||||
db_table = "Certifications"
|
||||
permissions = [
|
||||
(
|
||||
"receive_certification_emails",
|
||||
"Receives notifications of all new certifications",
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
class InstructorOrVendor(models.Model):
|
||||
|
Loading…
Reference in New Issue
Block a user