Opened 11 years ago

Closed 7 years ago

#12018 closed New feature (wontfix)

Use "RequestContext" instead of "Context" for comments moderation email

Reported by: Charlie DeTar Owned by: nobody
Component: contrib.comments Version: master
Severity: Normal Keywords: dceu2011
Cc: chazen@… Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no


The django.contrib.comments moderation framework allows users to send an email to site admins when a comment is posted. The email is formatted using the template "comments/comment_notification_email.txt". However, this template is rendered using a Context object, not RequestContext, making it impossible to add additional context parameters for the template renderer.

An example of the type of additional context one might want in an email is a site url, allowing the template to provide a link to the comment or admin functions on the site.

Attachments (3)

comments_request_context.diff (1.0 KB) - added by Charlie DeTar 11 years ago.
comments_request_context2.diff (2.4 KB) - added by Adam Vandenberg 9 years ago.
12018.diff (6.8 KB) - added by Thejaswi Puthraya 9 years ago.
patch against the latest git checkout

Download all attachments as: .zip

Change History (13)

Changed 11 years ago by Charlie DeTar

comment:1 Changed 10 years ago by Jannis Leidel

Needs tests: set
Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 10 years ago by Thejaswi Puthraya

As pointed out by mattmcc on IRC, this ticket doesn't address the requirement for an 'extra_context' argument. So even though a RequestContext is used, it gives access to the Request object but the context cannot be customized further.

comment:3 Changed 10 years ago by Charlie DeTar

Agreed -- 'extra_context' would be useful; but both would be better. RequestContext allows the context processors defined in to contribute to the context (including MEDIA_URL, etc); thus one could get extra context by adding additional context processors (at the expense of these appearing for other requests as well). 'extra_context' would allow additional parameters beyond that, or specific parameters for this case.

Changed 9 years ago by Adam Vandenberg

comment:4 Changed 9 years ago by Julien Phalip

Severity: Normal
Type: New feature

comment:5 Changed 9 years ago by Thejaswi Puthraya

Easy pickings: unset
Patch needs improvement: set
UI/UX: unset
Version: 1.1SVN

Not a valid patch because RequestContext's first argument must be the request object.

Changed 9 years ago by Thejaswi Puthraya

Attachment: 12018.diff added

patch against the latest git checkout

comment:6 Changed 9 years ago by Thejaswi Puthraya

Keywords: dceu2011 added
Patch needs improvement: unset

Latest patch includes tests.

comment:7 Changed 9 years ago by Harro

I'd argue email shouldn't be send in the request/response cycle. You often have to send e-mails outside of it.

comment:8 Changed 9 years ago by Thejaswi Puthraya

@hvdklauw: This patch has nothing to do with the sending of mail, it only provides the comment notification template access to the RequestContext and thus the various context processors that might have been written.

comment:9 Changed 9 years ago by Harro

It is, because you are rendering the email body with it.

comment:10 Changed 7 years ago by Jacob

Resolution: wontfix
Status: newclosed

django.contrib.comments has been deprecated and is no longer supported, so I'm closing this ticket. We're encouraging users to transition to a custom solution, or to a hosted solution like Disqus.

The code itself has moved to; if you want to keep using it, you could move this bug over there.

Note: See TracTickets for help on using tickets.
Back to Top