Fix bug (encore)
This commit is contained in:
parent
5240f426c1
commit
77941ed0ee
@ -1165,22 +1165,23 @@ class Event(models.Model):
|
||||
messages = self.get_contributor_message()
|
||||
logger.warning("messages: ")
|
||||
logger.warning(messages)
|
||||
for message in messages:
|
||||
if message and not message.closed and message.email:
|
||||
# send email
|
||||
context = {"sitename": Site.objects.get_current(request).name, 'event_title': self.title }
|
||||
if self.status == Event.STATUS.PUBLISHED:
|
||||
context["url"] = request.build_absolute_uri(self.get_absolute_url())
|
||||
subject = _('Your event has been published')
|
||||
body = render_to_string("agenda_culturel/emails/published.txt", context)
|
||||
else:
|
||||
subject = _('Your message has not been retained')
|
||||
body = render_to_string("agenda_culturel/emails/retained.txt", context)
|
||||
if messages:
|
||||
for message in messages:
|
||||
if message and not message.closed and message.email:
|
||||
# send email
|
||||
context = {"sitename": Site.objects.get_current(request).name, 'event_title': self.title }
|
||||
if self.status == Event.STATUS.PUBLISHED:
|
||||
context["url"] = request.build_absolute_uri(self.get_absolute_url())
|
||||
subject = _('Your event has been published')
|
||||
body = render_to_string("agenda_culturel/emails/published.txt", context)
|
||||
else:
|
||||
subject = _('Your message has not been retained')
|
||||
body = render_to_string("agenda_culturel/emails/retained.txt", context)
|
||||
|
||||
send_mail(subject, body, None, [message.email])
|
||||
message.closed = True
|
||||
message.save()
|
||||
notif = True
|
||||
send_mail(subject, body, None, [message.email])
|
||||
message.closed = True
|
||||
message.save()
|
||||
notif = True
|
||||
|
||||
return notif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user