djangosnippets.org: Latest snippets tagged with 'comments'http://djangosnippets.org/tags/comments/2012-10-20T17:49:27.612326-05:00Clean spam from comments by running management command and akismet
2012-10-20T17:49:27.612326-05:00iElectrichttp://djangosnippets.org/snippets/2835/<p>..</p>
Freely redistributablecomments_allowed function for your model/...
2010-08-11T04:37:51.223529-05:00mathijshttp://djangosnippets.org/snippets/2144/<p>Use this if you want to check if commenting is allowed for a certain object/model/... in a template. Like this;
</p>
<p><code>{% if not object.comments_allowed %}
<p>Comments are now closed.</p>
{% else %}
{% render_comment_form for object %}
{% endif %}</code>
</p>
<p>You can replace the CommentModerator class with your own custom …</p>
Freely redistributablePrevent Django newcomments spam with Akismet (reloaded)
2009-07-17T02:20:04.313759-05:00sciyoshihttp://djangosnippets.org/snippets/1638/<p>This is a rewrite of <a href="http://www.djangosnippets.org/snippets/1006/">snippet #1006</a> to use the moderation features available in Django's comments framework. This is more customizable than the signals approach and works well if other moderation features are being used. If you want to make comments that are flagged as spam become hidden instead of …</p>
Freely redistributableSignal to notify new saved comments
2009-05-31T17:29:55.122339-05:00arthurfurlanhttp://djangosnippets.org/snippets/1539/<p>Signal to notify new saved comments.</p>
<p><strong>Example:</strong></p>
<pre><code>from django.contrib.comment import models, signals
signals.comment_was_posted.connect(new_comment_notifier,
sender=models.Comment)
</code></pre>
Freely redistributableUnobtrusive comment moderation, updated for Django 1.0
2009-01-21T09:19:48.081282-06:00shimonrurahttp://djangosnippets.org/snippets/1294/<p>This is the "unobtrusive comments moderation" code from http://www.djangosnippets.org/snippets/112/ , but updated so it works properly with Django 1.0.</p>
<p>There are only a few small changes reflecting changes in the comments, contenttypes, and signals APIs.</p>
<p>For full background, see the original snippet:
http://www.djangosnippets.org/snippets/112/</p>
Freely redistributableRemoving all the extra comment fields
2008-11-16T00:55:13.279901-06:00dipankarsarkarhttp://djangosnippets.org/snippets/1195/<p>This helps you remove the extra comments fields from appearing in the form. If you used just form they would appear. This is for Django 1.0 + only.
</p>
<p>By <a href="http://dipankar.name">Dipankar Sarkar</a>
<a href="http://desinerd.com">Blog</a>
me@dipankar.name
</p>
Freely redistributableGravatar support for Django comments
2008-10-09T21:13:43.967144-05:00jonathanhttp://djangosnippets.org/snippets/1124/<p>A templatetag to add <a href="http://www.gravatar.com/">Gravatar</a> support for <a href="http://docs.djangoproject.com/en/dev/ref/contrib/comments/" title="Django Comments">Django comments</a>. Based on <a href="http://www.djangosnippets.org/snippets/772/">this snippet</a> but works for everyone who comments even if they are not a registered user.</p>
Freely redistributableUsing Akismet/TypePad AntiSpam with Django's new comments framework
2008-08-27T18:27:54.252749-05:00sciyoshihttp://djangosnippets.org/snippets/1006/<p>See the description in the blog entry at <a href="http://sciyoshi.com/blog/2008/aug/27/using-akismet-djangos-new-comments-framework/">http://sciyoshi.com/blog/2008/aug/27/using-akismet-djangos-new-comments-framework/</a>
</p>
Freely redistributableRecaptcha with Django Comments
2007-11-21T12:18:59.821851-06:00nikolajhttp://djangosnippets.org/snippets/478/<p>Working off b23's <a href="http://www.djangosnippets.org/snippets/433/">recaptcha support</a>, I have hacked a way to add recaptcha support using existing comments. I am sure there is a better way, and ultimately I will suggest a patch to add captcha support as an option, but for now I hope this helps. For a more …</p>
Freely redistributableEmail on new comments
2007-08-15T17:34:40.174895-05:00ubernostrumhttp://djangosnippets.org/snippets/367/<p>In response to <a href="/snippets/366/">#366</a>, this is a subclass of the <code>CommentModerator</code> class from <code>comment_utils</code> which does nothing except email the "owner" of an object whenever a new comment is posted on it; all other moderation options remain inactive.</p>
Freely redistributableEmail on new comments
2007-08-15T16:50:50.008820-05:00nikolajhttp://djangosnippets.org/snippets/366/<p>I know ubernostrum has the nice comment_utils, but I need something that would notify the owner of the comment's content object (where the model has a foreignkey field to django.contrib.auth.models.User), but I didn't need all the moderation stuff. I stuck this in my models.py, where YOURMODEL is the name of …</p>
Freely redistributableCheetah-style comments
2007-07-18T20:18:41.587871-05:00olivierhttp://djangosnippets.org/snippets/326/<p>For those who find the Django comments syntax tedious, this snippet enables the use of (almost) Cheetah-style comments.</p>
Freely redistributableStrip html comments middleware
2007-03-21T18:13:42.195217-05:00trbshttp://djangosnippets.org/snippets/123/<p>Middleware for stripping all html comments from the response content before returning it to the client.</p>
<p>This will also strip inline javascript with htmlcomments put around it!</p>
Freely redistributableUnobtrusive comment moderation
2007-03-17T00:36:49.093099-05:00ubernostrumhttp://djangosnippets.org/snippets/112/<p><strong>Before using this snippet</strong>, please note that it's largely been superseded by <a href="http://code.google.com/p/django-comment-utils/">comment_utils</a>, which includes a more featureful and extensible version of this system, particularly with respect to additional moderation options and useful things like email notifications of comments.</p>
<p>Once upon a time I hacked the copy of …</p>
Freely redistributableGet most-commented objects
2007-03-14T22:55:23.561115-05:00ubernostrumhttp://djangosnippets.org/snippets/108/<p>This is a pretty straightforward bit of code for getting the most-commented objects of a particular model; just drop it into a custom manager for that model, and you should be good to go. Check the docstring for how to make it look at <code>Comment</code> instead of <code>FreeComment</code>.</p>
Freely redistributable