Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove all code related to comments.

They were turned off on July 28th, 2009.
  • Loading branch information...
commit 747929aa2cc9767008e66946ca74f83794672418 1 parent 01b5ef5
@aaugustin aaugustin authored
View
48 blog/models.py
@@ -1,29 +1,24 @@
-import akismet
import datetime
from docutils.core import publish_parts
from django.conf import settings
from django.db import models
-from django.contrib.sites.models import Site
-from django.contrib.comments.signals import comment_was_posted
from django.utils.encoding import smart_str
from django.utils.translation import ugettext_lazy as _
-
-BLOG_DOCUTILS_SETTINGS = getattr(settings, 'BLOG_DOCUTILS_SETTINGS',
- { 'doctitle_xform': False,
- 'initial_header_level': 4,
- 'id_prefix': 's-',
- }
-)
+BLOG_DOCUTILS_SETTINGS = getattr(settings, 'BLOG_DOCUTILS_SETTINGS', {
+ 'doctitle_xform': False,
+ 'initial_header_level': 4,
+ 'id_prefix': 's-',
+})
class EntryManager(models.Manager):
-
+
def published(self):
return self.active().filter(pub_date__lte=datetime.datetime.now())
-
+
def active(self):
return super(EntryManager, self).get_query_set().filter(is_active=True)
@@ -31,7 +26,7 @@ def active(self):
(u'reST', u'reStructuredText'),
(u'html', u'Raw HTML'),
)
-
+
class Entry(models.Model):
headline = models.CharField(max_length=200)
slug = models.SlugField(unique_for_date='pub_date')
@@ -45,7 +40,7 @@ class Entry(models.Model):
author = models.CharField(max_length=100)
objects = EntryManager()
-
+
class Meta:
db_table = 'blog_entries'
verbose_name_plural = 'entries'
@@ -57,18 +52,13 @@ def __unicode__(self):
def get_absolute_url(self):
return "/weblog/%s/%s/" % (self.pub_date.strftime("%Y/%b/%d").lower(), self.slug)
-
+
def is_published(self):
"""
Return True if the entry is publicly accessible.
"""
return self.is_active and self.pub_date <= datetime.datetime.now()
is_published.boolean = True
-
- @property
- def comments_enabled(self):
- delta = datetime.datetime.now() - self.pub_date
- return delta.days < 60
def save(self, *args, **kwargs):
if self.content_format == u'html':
@@ -82,21 +72,3 @@ def save(self, *args, **kwargs):
writer_name="html",
settings_overrides=BLOG_DOCUTILS_SETTINGS)['fragment']
super(Entry, self).save(*args, **kwargs)
-
-def moderate_comment(sender, comment, request, **kwargs):
- ak = akismet.Akismet(
- key = settings.AKISMET_API_KEY,
- blog_url = 'http://%s/' % Site.objects.get_current().domain
- )
- data = {
- 'user_ip': request.META.get('REMOTE_ADDR', '127.0.0.1'),
- 'user_agent': request.META.get('HTTP_USER_AGENT', ''),
- 'referrer': request.META.get('HTTP_REFERRER', ''),
- 'comment_type': 'comment',
- 'comment_author': smart_str(comment.user_name),
- }
- if ak.comment_check(smart_str(comment.comment), data=data, build_data=True):
- comment.is_public = False
- comment.save()
-
-comment_was_posted.connect(moderate_comment)
View
3  django_website/sitemaps.py
@@ -37,6 +37,5 @@ class WeblogSitemap(Sitemap):
def items(self):
return Entry.objects.published()
- # lastmod is not implemented, because weblog pages contain comments.
- # We'd rather not look up the date of the latest comment -- not worth the overhead.
+ # lastmod wasn't implemented, because weblog pages used to contain comments.
View
1  django_www/settings.py
@@ -69,7 +69,6 @@
'django.contrib.sites',
'django.contrib.auth',
'django.contrib.admin',
- 'django.contrib.comments',
'django.contrib.contenttypes',
'django.contrib.flatpages',
'django.contrib.humanize',
View
10 django_www/urls.py
@@ -3,8 +3,6 @@
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
-from django.contrib.comments.feeds import LatestCommentFeed
-from django.contrib.comments.models import Comment
from django.contrib.flatpages.views import flatpage
from django.contrib.sitemaps import views as sitemap_views
from django.views.decorators.cache import cache_page
@@ -19,11 +17,6 @@
admin.autodiscover()
-comments_info_dict = {
- 'queryset': Comment.objects.filter(is_public=True).order_by('-submit_date'),
- 'paginate_by': 15,
-}
-
sitemaps = {
'weblog': WeblogSitemap,
'flatpages': FlatPageSitemap,
@@ -36,8 +29,6 @@
url(r'^$', TemplateView.as_view(template_name='homepage.html'), name="homepage"),
url(r'^accounts/', include('accounts.urls')),
url(r'^admin/', include(admin.site.urls)),
- url(r'^comments/$', 'django.views.generic.list_detail.object_list', comments_info_dict),
- url(r'^comments/', include('django.contrib.comments.urls')),
url(r'^community/', include('aggregator.urls')),
url(r'^contact/', include('contact.urls')),
url(r'^r/', include('django.conf.urls.shortcut')),
@@ -47,7 +38,6 @@
# Feeds
url(r'^rss/weblog/$', WeblogEntryFeed(), name='weblog-feed'),
- url(r'^rss/comments/$', LatestCommentFeed(), name='comments-feed'),
url(r'^rss/community/$', redirect_to, {'url': '/rss/community/blogs/'}),
url(r'^rss/community/firehose/$', CommunityAggregatorFirehoseFeed(), name='aggregator-firehose-feed'),
url(r'^rss/community/(?P<slug>[\w-]+)/$', CommunityAggregatorFeed(), name='aggregator-feed'),
View
10 legacy/urls.py
@@ -9,8 +9,10 @@
from .views import gone
urlpatterns = patterns('',
- (r'^documentation/models/$', gone),
- (r'^documentation/models/(?P<slug>\w+)/$', gone),
- (r'^documentation/(?P<version>[\d.]+)/models/$', gone),
- (r'^documentation/(?P<version>[\d.]+)/models/(?P<slug>\w+)/$', gone),
+ (r'^comments/', gone),
+ (r'^rss/comments/$', gone),
+ (r'^documentation/models/$', gone),
+ (r'^documentation/models/(?P<slug>\w+)/$', gone),
+ (r'^documentation/(?P<version>[\d.]+)/models/$', gone),
+ (r'^documentation/(?P<version>[\d.]+)/models/(?P<slug>\w+)/$', gone),
)
View
13 static/css/base.css
@@ -664,19 +664,6 @@ div.versionchanged span.title {
font-size:90%;
}
-/* COMMENTS */
-
-.comment {
- margin:15px 0;
-}
-div.comment p {
- margin-left:1em;
-}
-#weblog div.comment p.date {
- margin-bottom:.2em;
- color:#94da3a;
-}
-
/* FORMS */
form.wide label {
display: block;
View
1  templates/base_community.html
@@ -41,7 +41,6 @@
<h2>Improve Django</h2>
<ul>
<li><a href="http://groups.google.com/group/django-updates">django-updates mailing list</a> &mdash; get updated for each code and ticket change (for the super-obsessed)</li>
-<li>Post comments on any page of this site. <a href="/comments/">View recent comments</a>.</li>
<li><a href="https://code.djangoproject.com/wiki">Django wiki</a> &mdash; contribute tips and documentation</a></li>
</ul>
View
1  templates/base_weblog.html
@@ -17,7 +17,6 @@
<h2>RSS feeds</h2>
<ul class="linklist">
<li><a href="/rss/weblog/">Latest weblog entries</a></li>
- <li><a href="/rss/comments/">Latest comments</a></li>
<li><a href="https://code.djangoproject.com/timeline?daysback=90&amp;max=50&amp;wiki=on&amp;ticket=on&amp;changeset=on&amp;milestone=on&amp;format=rss">Recent code changes</a></li>
</ul>
{% endblock %}
View
1  templates/comments/base.html
@@ -1 +0,0 @@
-{% extends "base_weblog.html" %}
View
48 templates/comments/comment_list.html
@@ -1,48 +0,0 @@
-{% extends "base_weblog.html" %}
-
-{% block extrahead %}
- <link rel="alternate" type="application/rss+xml" title="RSS" href="/rss/comments/" />
-{% endblock %}
-
-{% block title %}Recent comments{% endblock %}
-
-{% block content %}
-
-<h1>Recent comments</h1>
-
-<p>
- {% if has_previous %}
- <a href="?page={{ previous }}">Previous</a> |
- {% endif %}
- Page {{ page }} of {{ pages }}
- {% if has_next %}
- | <a href="?page={{ next }}">Next</a>
- {% endif %}
-</p>
-
-{% for comment in object_list %}
-<div class="comment" id="c{{ comment.id }}">
- <h3>
- <a href="{{ comment.get_absolute_url }}">
- {{ comment.person_name|escape }}
- <span class="small quiet">
- {{ comment.submit_date|date:"F j, Y" }} at {{ comment.submit_date|date:"P" }}
- </span>
- </a>
- {% if perms.comments %}
- <form style="display: inline" action="/admin/comments/freecomment/{{ comment.id }}/delete/" method="post">
- <input type="hidden" name="post" value="yes" />
- <input type="hidden" name="next" value="/comments/">
- <input type="submit" value="X" style="padding: 0; font-size: 9px; border-width: 1px;">
- </form>
- {% endif %}
- </h3>
- {{ comment.comment|escape|urlizetrunc:"40"|linebreaks }}
-</div>
-{% endfor %}
-
-<p>{% if has_previous %}<a href="?page={{ previous }}">Previous</a> | {% endif %}
-Page {{ page }} of {{ pages }}
-{% if has_next %} | <a href="?page={{ next }}">Next</a>{% endif %}</p>
-
-{% endblock %}
View
22 templates/comments/form.html
@@ -1,22 +0,0 @@
-{% load comments %}
-<form action="{% comment_form_target %}" method="post" class="wide">
- {% for field in form %}
- {% if field.is_hidden %}
- {{ field }}
- {% else %}
- <p
- {% if field.errors %} class="error"{% endif %}
- {% ifequal field.name "honeypot" %} style="display:none;"{% endifequal %}>
- {{ field.label_tag }}
- {% if field.errors %}
- <p class="errors">{{ field.errors.as_text }}</p>
- {% endif %}
- {{ field }}
- </p>
- {% endif %}
- {% endfor %}
- <p class="submit">
- <input type="submit" name="submit" class="submit-post" value="Post" />
- <input type="submit" name="submit" class="submit-preview" value="Preview" />
- </p>
-</form>
View
17 templates/comments/posted.html
@@ -1,17 +0,0 @@
-{% extends "base.html" %}
-
-{% block title %}Comment posted{% endblock %}
-
-{% block content %}
-
-<h1>Comment posted successfully</h1>
-
-<p>Thanks for contributing.</p>
-
-{% if object %}
-<ul>
-<li><a href="{{ object.get_absolute_url }}">View your comment</a></li>
-</ul>
-{% endif %}
-
-{% endblock %}
View
7 templates/comments/preview.html
@@ -1,7 +0,0 @@
-{% extends "comments/base.html" %}
-
-{% block title %}Preview your comment{% endblock %}
-
-{% block content %}
- {% include "comments/form.html" %}
-{% endblock %}
View
3  templates/feeds/comments_description.html
@@ -1,3 +0,0 @@
-<p>Posted by {{ obj.person_name }} on {{ obj.submit_date|date:"F j, Y" }} at {{ obj.submit_date|date:"P" }}</p>
-<p>Page: {{ obj.get_content_object }}</p>
-{{ obj.comment|linebreaks }}
View
1  templates/feeds/comments_title.html
@@ -1 +0,0 @@
-<p>Comment by {{ obj.person_name }} on {{ obj.submit_date|date:"F j, Y" }}</p>
View
3  templates/flatpages/docs.html
@@ -4,7 +4,7 @@
<h1>{{ flatpage.title }}</h1>
{% ifequal version "trunk" %}
-
+
{% endifequal %}
{{ flatpage.content }}
@@ -25,7 +25,6 @@
<li><a href="http://groups.google.com/group/django-users">Django-users mailing list</a></li>
<li><a href="http://groups.google.com/group/django-developers">Django-developers mailing list</a></li>
<li><a href="https://code.djangoproject.com/newticket">Report a bug</a></li>
- {# <li><a href="/comments/">Recent comments posted to djangoproject.com</a></li> #}
</ul>
{% endblock %}
Please sign in to comment.
Something went wrong with that request. Please try again.