Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Converting to use groups, rather than hard coded email addresses.

  • Loading branch information...
commit 73f3812982f2945ce506fc1ce68d8a6dd1db9be9 1 parent 2e84df7
@justinabrahms justinabrahms authored
View
11 django_website/aggregator/management/commands/send_pending_approval_email.py
@@ -5,7 +5,8 @@
from __future__ import absolute_import
from django.conf import settings
-from django.core.mail import send_mail
+from django.contrib.auth.models import User
+from django.core import mail
from django.core.management.base import NoArgsCommand
from django.template import Context, Template
from ...models import Feed, PENDING_FEED
@@ -19,6 +20,7 @@ def handle_noargs(self, **kwargs):
verbosity = 1
feeds = Feed.objects.filter(approval_status=PENDING_FEED)
+ to_email = [x.email for x in User.objects.filter(groups__name=settings.FEED_APPROVERS_GROUP_NAME)]
if len(feeds) == 0:
if verbosity >= 1:
@@ -39,8 +41,9 @@ def handle_noargs(self, **kwargs):
print "Pending approval email:\n"
print message
- send_mail("django community feeds pending approval", message,
- 'nobody@djangoproject.com', settings.FEED_APPROVERS)
+ mail.send_mail("django community feeds pending approval", message,
+ 'nobody@djangoproject.com', to_email,
+ fail_silently=False)
if verbosity >= 1:
- print "Sent pending approval email to: %s" % (', '.join(settings.FEED_APPROVERS))
+ print "Sent pending approval email to: %s" % (', '.join(to_email))
Please sign in to comment.
Something went wrong with that request. Please try again.