aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-03-13 00:31:43 +0100
committerGravatar Tom Willemsen2012-03-13 00:31:43 +0100
commit1ea700b294025e118fa3c48c0fbf2b63dc106597 (patch)
tree6bcdd337269d2abe9e12b118f2c47b0b8f39a0c1
parent2eb133ff56911eec60997e882fae63e961a291f3 (diff)
downloadryuslash.org-1ea700b294025e118fa3c48c0fbf2b63dc106597.tar.gz
ryuslash.org-1ea700b294025e118fa3c48c0fbf2b63dc106597.zip
Add simple comments
-rw-r--r--aggregator/migrations/0002_auto__chg_field_post_post_id.py49
-rw-r--r--settings.py6
-rw-r--r--static/comments.css16
-rw-r--r--templates/aggregator/base.html1
-rw-r--r--templates/aggregator/post_detail.html12
-rw-r--r--urls.py5
6 files changed, 86 insertions, 3 deletions
diff --git a/aggregator/migrations/0002_auto__chg_field_post_post_id.py b/aggregator/migrations/0002_auto__chg_field_post_post_id.py
new file mode 100644
index 0000000..906ed2d
--- /dev/null
+++ b/aggregator/migrations/0002_auto__chg_field_post_post_id.py
@@ -0,0 +1,49 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+
+ # Changing field 'Post.post_id'
+ db.alter_column('aggregator_post', 'post_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255))
+
+
+ def backwards(self, orm):
+
+ # Changing field 'Post.post_id'
+ db.alter_column('aggregator_post', 'post_id', self.gf('django.db.models.fields.CharField')(max_length=500, unique=True))
+
+
+ models = {
+ 'aggregator.feed': {
+ 'Meta': {'ordering': "['-updated']", 'object_name': 'Feed'},
+ 'base_url': ('django.db.models.fields.URLField', [], {'max_length': '255'}),
+ 'br2nl': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'favicon_ext': ('django.db.models.fields.CharField', [], {'default': "'png'", 'max_length': '4'}),
+ 'feed_url': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'profile_url': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '500', 'blank': 'True'}),
+ 'updated': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'uses_title': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'with_markdown': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
+ },
+ 'aggregator.post': {
+ 'Meta': {'ordering': "['-updated']", 'object_name': 'Post'},
+ 'added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'body': ('django.db.models.fields.TextField', [], {}),
+ 'feed': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['aggregator.Feed']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'post_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
+ 'remote_url': ('django.db.models.fields.URLField', [], {'max_length': '255'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
+ 'updated': ('django.db.models.fields.DateTimeField', [], {})
+ }
+ }
+
+ complete_apps = ['aggregator']
diff --git a/settings.py b/settings.py
index 2c1a9bc..12ebdc5 100644
--- a/settings.py
+++ b/settings.py
@@ -111,7 +111,11 @@ TEMPLATE_DIRS = (
'%s/templates' % DEPLOY_PATH,
)
-INSTALLED_APPS = ('aggregator',
+INSTALLED_APPS = ('django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.comments',
+ 'django.contrib.staticfiles',
+ 'aggregator',
'south')
# A sample logging configuration. The only tangible logging
diff --git a/static/comments.css b/static/comments.css
new file mode 100644
index 0000000..b136c15
--- /dev/null
+++ b/static/comments.css
@@ -0,0 +1,16 @@
+#comments, form {
+ background-color: #808080;
+ padding: 5px;
+ border: 1px #505050 solid;
+ margin-bottom: 15px;
+ color: #000000;
+}
+
+#comments dd {
+ margin-left: 40px;
+ margin-bottom: 15px;
+}
+
+form label {
+ display: block;
+}
diff --git a/templates/aggregator/base.html b/templates/aggregator/base.html
index 1f3ec37..6a37f5a 100644
--- a/templates/aggregator/base.html
+++ b/templates/aggregator/base.html
@@ -5,6 +5,7 @@
<title>ryuslash</title>
<link href="/static/main.css" type="text/css" rel="stylesheet" />
<link rel="shortcut icon" href="/static/favicon.png" />
+ {% block head %}{% endblock %}
</head>
<body>
diff --git a/templates/aggregator/post_detail.html b/templates/aggregator/post_detail.html
index eb39f95..574d9b1 100644
--- a/templates/aggregator/post_detail.html
+++ b/templates/aggregator/post_detail.html
@@ -1,8 +1,20 @@
{% extends "aggregator/base.html" %}
+{% load comments %}
+
+{% block head %}
+<link href="/static/comments.css" type="text/css" rel="stylesheet" />
+{% endblock %}
{% block content %}
{% include "aggregator/post_content.html" with post=object %}
+{% get_comment_count for object as comment_count %}
+{% if comment_count > 0 %}
+ {% render_comment_list for object %}
+{% endif %}
+
+{% render_comment_form for object %}
+
<div id="pager">
{% with next=object.get_next_by_updated previous=object.get_previous_by_updated %}
{% if previous %}
diff --git a/urls.py b/urls.py
index c42fbb6..af2a313 100644
--- a/urls.py
+++ b/urls.py
@@ -1,4 +1,4 @@
-from django.conf.urls.defaults import patterns, url
+from django.conf.urls.defaults import patterns, url, include
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views.generic import DetailView
@@ -8,6 +8,7 @@ from aggregator.feeds import LatestPostsFeed
urlpatterns = patterns('',
url(r'^((?P<page>\d+)/)?$', 'aggregator.views.posts'),
url(r'^post/((?P<pk>\d+)/)?$', DetailView.as_view(model=Post)),
- url(r'^feed/posts/$', LatestPostsFeed()))
+ url(r'^feed/posts/$', LatestPostsFeed()),
+ url(r'^comments/', include('django.contrib.comments.urls')))
urlpatterns += staticfiles_urlpatterns()