Commit 8bc53a3b by Őry Máté

dashboard: add better identifierts

parent 5195f8b3
......@@ -32,28 +32,27 @@ logger = logging.getLogger(__name__)
def send_email_notifications():
msgs = {}
q = Q( & (
Q( | Q(valid_until=None))
for i in Notification.objects.filter(q):
if not in msgs:
msgs[] = []
from_email = settings.DEFAULT_FROM_EMAIL
for user, i in msgs.iteritems():
recipients = {}
for i in Notification.objects.filter(q):
recipients.setdefault(, [])
for user, msgs in recipients.iteritems():
if (not user.profile or not or not
logger.debug("%s gets no notifications", unicode(user))
with override(user.profile.preferred_language):
context = {'user': user.profile, 'messages': i,
context = {'user': user.profile, 'messages': msgs,
'url': (settings.DJANGO_URL.rstrip("/") +
'site': settings.COMPANY_NAME}
subject = ungettext("%d new notification",
"%d new notifications", len(i)) % len(i)
"%d new notifications", len(msgs)) % len(msgs)
body = render_to_string('dashboard/notifications/email.txt',
......@@ -62,7 +61,7 @@ def send_email_notifications():
logger.error("Failed to send mail to %s", user, exc_info=True)
else:"Delivered notifications %s",
" ".join(unicode( for j in i))
for j in i:
j.status = j.STATUS.delivered
" ".join(unicode( for i in msgs))
for i in msgs:
i.status = i.STATUS.delivered
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment