diff --git a/django/contrib/comments/moderation.py b/django/contrib/comments/moderation.py
index 17d61da..358ab47 100644
a
|
b
|
from django.conf import settings
|
60 | 60 | from django.core.mail import send_mail |
61 | 61 | from django.contrib.comments import signals |
62 | 62 | from django.db.models.base import ModelBase |
63 | | from django.template import Context, loader |
| 63 | from django.template import RequestContext, loader |
64 | 64 | from django.contrib import comments |
65 | 65 | from django.contrib.sites.models import Site |
66 | 66 | |
… |
… |
class CommentModerator(object):
|
227 | 227 | return True |
228 | 228 | return False |
229 | 229 | |
230 | | def email(self, comment, content_object, request): |
| 230 | def email(self, comment, content_object, request, extra_context=None): |
231 | 231 | """ |
232 | 232 | Send email notification of a new comment to site staff when email |
233 | 233 | notifications have been requested. |
… |
… |
class CommentModerator(object):
|
237 | 237 | return |
238 | 238 | recipient_list = [manager_tuple[1] for manager_tuple in settings.MANAGERS] |
239 | 239 | t = loader.get_template('comments/comment_notification_email.txt') |
240 | | c = Context({ 'comment': comment, |
241 | | 'content_object': content_object }) |
| 240 | |
| 241 | context = { 'comment': comment, 'content_object': content_object } |
| 242 | context.update(extra_context or {}) |
242 | 243 | subject = '[%s] New comment posted on "%s"' % (Site.objects.get_current().name, |
243 | 244 | content_object) |
244 | | message = t.render(c) |
| 245 | message = t.render(RequestContext(context)) |
245 | 246 | send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, recipient_list, fail_silently=True) |
246 | 247 | |
247 | 248 | class Moderator(object): |
diff --git a/docs/ref/contrib/comments/moderation.txt b/docs/ref/contrib/comments/moderation.txt
index 4f4b326..2329bd0 100644
a
|
b
|
object the comment will be attached to, and ``request``, which is the
|
159 | 159 | post on the content object, and ``False`` otherwise (in which |
160 | 160 | case the comment will be immediately deleted). |
161 | 161 | |
162 | | .. method:: CommentModerator.email(comment, content_object, request) |
| 162 | .. method:: CommentModerator.email(comment, content_object, request, extra_context=None) |
163 | 163 | |
164 | 164 | If email notification of the new comment should be sent to |
165 | 165 | site staff or moderators, this method is responsible for |