Remove the news app
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
import models
|
||||
from django.contrib import admin
|
||||
|
||||
admin.site.register(models.Post)
|
||||
admin.site.register(models.Comment)
|
@@ -1,7 +0,0 @@
|
||||
from django import forms
|
||||
import models
|
||||
|
||||
class CommentForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = models.Comment
|
||||
exclude = ('author', 'post', 'parent', 'created', 'updated')
|
@@ -1,112 +0,0 @@
|
||||
# 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):
|
||||
|
||||
# Adding model 'Post'
|
||||
db.create_table('news_post', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
('title', self.gf('django.db.models.fields.CharField')(max_length=100)),
|
||||
('body', self.gf('django.db.models.fields.TextField')()),
|
||||
('slug', self.gf('django.db.models.fields.SlugField')(db_index=True, max_length=50, blank=True)),
|
||||
('author', self.gf('django.db.models.fields.related.ForeignKey')(related_name='news_posts', to=orm['auth.User'])),
|
||||
('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
|
||||
('updated', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
|
||||
))
|
||||
db.send_create_signal('news', ['Post'])
|
||||
|
||||
# Adding model 'Comment'
|
||||
db.create_table('news_comment', (
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
('post', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='comments', null=True, to=orm['news.Post'])),
|
||||
('parent', self.gf('mptt.fields.TreeForeignKey')(blank=True, related_name='children', null=True, to=orm['news.Comment'])),
|
||||
('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
|
||||
('body', self.gf('django.db.models.fields.TextField')()),
|
||||
('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
|
||||
('updated', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
|
||||
('lft', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),
|
||||
('rght', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),
|
||||
('tree_id', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),
|
||||
('level', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),
|
||||
))
|
||||
db.send_create_signal('news', ['Comment'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Deleting model 'Post'
|
||||
db.delete_table('news_post')
|
||||
|
||||
# Deleting model 'Comment'
|
||||
db.delete_table('news_comment')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
|
||||
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
|
||||
},
|
||||
'auth.permission': {
|
||||
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
|
||||
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
|
||||
},
|
||||
'auth.user': {
|
||||
'Meta': {'object_name': 'User'},
|
||||
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
|
||||
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
||||
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
|
||||
},
|
||||
'contenttypes.contenttype': {
|
||||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
|
||||
},
|
||||
'news.comment': {
|
||||
'Meta': {'object_name': 'Comment'},
|
||||
'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
|
||||
'body': ('django.db.models.fields.TextField', [], {}),
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
|
||||
'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
|
||||
'parent': ('mptt.fields.TreeForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['news.Comment']"}),
|
||||
'post': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comments'", 'null': 'True', 'to': "orm['news.Post']"}),
|
||||
'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
|
||||
'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
|
||||
'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
|
||||
},
|
||||
'news.post': {
|
||||
'Meta': {'ordering': "['-created']", 'object_name': 'Post'},
|
||||
'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'news_posts'", 'to': "orm['auth.User']"}),
|
||||
'body': ('django.db.models.fields.TextField', [], {}),
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '50', 'blank': 'True'}),
|
||||
'title': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||
'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['news']
|
@@ -1,85 +0,0 @@
|
||||
# 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):
|
||||
|
||||
# Adding field 'Post.published'
|
||||
db.add_column('news_post', 'published', self.gf('django.db.models.fields.BooleanField')(default=True), keep_default=False)
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Deleting field 'Post.published'
|
||||
db.delete_column('news_post', 'published')
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
|
||||
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
|
||||
},
|
||||
'auth.permission': {
|
||||
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
|
||||
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
|
||||
},
|
||||
'auth.user': {
|
||||
'Meta': {'object_name': 'User'},
|
||||
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
|
||||
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
||||
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
|
||||
},
|
||||
'contenttypes.contenttype': {
|
||||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
|
||||
},
|
||||
'news.comment': {
|
||||
'Meta': {'object_name': 'Comment'},
|
||||
'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
|
||||
'body': ('django.db.models.fields.TextField', [], {}),
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
|
||||
'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
|
||||
'parent': ('mptt.fields.TreeForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['news.Comment']"}),
|
||||
'post': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comments'", 'null': 'True', 'to': "orm['news.Post']"}),
|
||||
'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
|
||||
'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
|
||||
'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
|
||||
},
|
||||
'news.post': {
|
||||
'Meta': {'ordering': "['-created']", 'object_name': 'Post'},
|
||||
'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'news_posts'", 'to': "orm['auth.User']"}),
|
||||
'body': ('django.db.models.fields.TextField', [], {}),
|
||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'published': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
||||
'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '50', 'blank': 'True'}),
|
||||
'title': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||
'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['news']
|
@@ -1,69 +0,0 @@
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from mptt.models import MPTTModel, TreeForeignKey
|
||||
|
||||
def unique_slug(item,slug_source,slug_field):
|
||||
"""Ensures a unique slug field by appending an integer counter to duplicate slugs.
|
||||
|
||||
The item's slug field is first prepopulated by slugify-ing the source field. If that value already exists, a counter is appended to the slug, and the counter incremented upward until the value is unique.
|
||||
|
||||
For instance, if you save an object titled Daily Roundup, and the slug daily-roundup is already taken, this function will try daily-roundup-2, daily-roundup-3, daily-roundup-4, etc, until a unique value is found.
|
||||
|
||||
Call from within a model's custom save() method like so:
|
||||
unique_slug(item, slug_source='field1', slug_field='field2')
|
||||
where the value of field slug_source will be used to prepopulate the value of slug_field.
|
||||
"""
|
||||
if not getattr(item, slug_field): # if it's already got a slug, do nothing.
|
||||
from django.template.defaultfilters import slugify
|
||||
slug = slugify(getattr(item,slug_source))
|
||||
itemModel = item.__class__
|
||||
# the following gets all existing slug values
|
||||
allSlugs = [sl.values()[0] for sl in itemModel.objects.values(slug_field)]
|
||||
if slug in allSlugs:
|
||||
import re
|
||||
counterFinder = re.compile(r'-\d+$')
|
||||
counter = 2
|
||||
slug = "%s-%i" % (slug, counter)
|
||||
while slug in allSlugs:
|
||||
slug = re.sub(counterFinder,"-%i" % counter, slug)
|
||||
counter += 1
|
||||
setattr(item,slug_field,slug)
|
||||
|
||||
class Post(models.Model):
|
||||
title = models.CharField(max_length=100)
|
||||
body = models.TextField()
|
||||
slug = models.SlugField(blank=True)
|
||||
author = models.ForeignKey(User, related_name='news_posts')
|
||||
published = models.BooleanField(default=True)
|
||||
created = models.DateTimeField(editable=False, auto_now_add=True)
|
||||
updated = models.DateTimeField(editable=False, auto_now=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ['-created']
|
||||
|
||||
def __unicode__(self):
|
||||
return self.title
|
||||
|
||||
@models.permalink
|
||||
def get_absolute_url(self):
|
||||
return ('news.views.view', [], {'slug':self.slug})
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
unique_slug(self, slug_source='title', slug_field='slug')
|
||||
super(Post, self).save(*args, **kwargs)
|
||||
|
||||
class Comment(MPTTModel):
|
||||
post = models.ForeignKey(Post, blank=True, null=True, related_name='comments')
|
||||
parent = TreeForeignKey('self', blank=True, null=True, related_name='children')
|
||||
author = models.ForeignKey(User)
|
||||
body = models.TextField()
|
||||
created = models.DateTimeField(editable=False, auto_now_add=True)
|
||||
updated = models.DateTimeField(editable=False, auto_now=True)
|
||||
|
||||
def news_post(self):
|
||||
if self.parent is None:
|
||||
return self.post
|
||||
return self.get_root().post
|
||||
|
||||
def __unicode__(self):
|
||||
return self.body
|
@@ -1,16 +0,0 @@
|
||||
"""
|
||||
This file demonstrates writing tests using the unittest module. These will pass
|
||||
when you run "manage.py test".
|
||||
|
||||
Replace this with more appropriate tests for your application.
|
||||
"""
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
class SimpleTest(TestCase):
|
||||
def test_basic_addition(self):
|
||||
"""
|
||||
Tests that 1 + 1 always equals 2.
|
||||
"""
|
||||
self.assertEqual(1 + 1, 2)
|
31
news/urls.py
31
news/urls.py
@@ -1,31 +0,0 @@
|
||||
from django.conf.urls.defaults import patterns, include, url
|
||||
from django.contrib.syndication.views import Feed
|
||||
import models
|
||||
|
||||
class NewsFeed(Feed):
|
||||
title = 'Caminus News'
|
||||
link = '/news/'
|
||||
description = 'News posts from Team Caminus'
|
||||
description_template = 'news/_feed_description.html'
|
||||
|
||||
def items(self):
|
||||
return models.Post.objects.order_by('-created').filter(published=True)[:5]
|
||||
|
||||
def item_title(self, item):
|
||||
return item.title
|
||||
|
||||
def item_description(self, item):
|
||||
return item.body
|
||||
|
||||
def item_author_name(self, item):
|
||||
return item.author
|
||||
|
||||
|
||||
urlpatterns = patterns('news',
|
||||
url('^$', 'views.index'),
|
||||
url('^comment/p/(?P<id>[0-9]+)$', 'views.comment'),
|
||||
url('^comment/c/(?P<parent>[0-9]+)$', 'views.comment'),
|
||||
url('^feed$', NewsFeed()),
|
||||
url('^(?P<page>[0-9]+)$', 'views.index'),
|
||||
url('^(?P<slug>.*)$', 'views.view')
|
||||
)
|
@@ -1,41 +0,0 @@
|
||||
import models
|
||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||
from django.shortcuts import render_to_response
|
||||
from django.template import RequestContext
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from notification import models as notification
|
||||
import forms
|
||||
|
||||
def index(request, page=0):
|
||||
all_news = models.Post.objects.all().filter(published=True)
|
||||
paginator = Paginator(all_news, 25)
|
||||
try:
|
||||
items = paginator.page(page)
|
||||
except EmptyPage:
|
||||
items = paginator.page(paginator.num_pages)
|
||||
return render_to_response('news/index.html', {'items':items}, context_instance = RequestContext(request))
|
||||
|
||||
def view(request, slug):
|
||||
item = models.Post.objects.get(slug__exact=slug)
|
||||
form = forms.CommentForm()
|
||||
return render_to_response('news/view.html', {'commentForm': form, 'item':item}, context_instance = RequestContext(request))
|
||||
|
||||
@login_required
|
||||
def comment(request, id=None, parent=None):
|
||||
form = forms.CommentForm(request.POST)
|
||||
if form.is_valid():
|
||||
c = models.Comment()
|
||||
c.author = request.user
|
||||
c.body = form.cleaned_data['body']
|
||||
if parent:
|
||||
parentPost = models.Comment.objects.get(id__exact=parent)
|
||||
c.parent = parentPost
|
||||
notification.send([parentPost.author], "news_comment_reply", {"comment": c})
|
||||
elif id:
|
||||
newsPost = models.Post.objects.get(id__exact=id)
|
||||
c.post = newsPost
|
||||
c.save()
|
||||
return HttpResponseRedirect(reverse('news.views.view', kwargs={'slug': c.news_post().slug})+"#c"+str(c.id))
|
||||
|
@@ -1,2 +0,0 @@
|
||||
{% load markup %}
|
||||
{{ obj.body|markdown }}
|
@@ -1,24 +0,0 @@
|
||||
{% extends 'news_base.html' %}
|
||||
{% load static %}
|
||||
{% load markup %}
|
||||
{% load minecraft %}
|
||||
|
||||
{% block title %}News{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% for post in items.object_list %}
|
||||
<div class='item news-item' itemscope itemtype="http://schema.org/BlogPosting">
|
||||
<h2><a href="{{post.get_absolute_url}}" itemprop="name">{{post.title}}</a></h2>
|
||||
<div class="byline">By <span itemprop="author">{{post.author}}</span> <div class="avatar">{% avatar post.author %}</div></div>
|
||||
<div class="dateline">On {{post.created}}</div>
|
||||
<div class="content" itemprop="articleBody">
|
||||
{{post.body|truncatewords:"100"|markdown}}
|
||||
</div>
|
||||
<div class="commentcount"><a href="{{post.get_absolute_url}}"><span itemprop="interactionCount">{{post.comments.all|length}} comment{{post.comments.all|length|pluralize}}</span> »</a></div>
|
||||
<br style="clear:both"/>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% get_static_prefix as STATIC_PREFIX %}
|
||||
<a href="/news/feed"><img src="{{ STATIC_PREFIX }}/feed.png"/></a>
|
||||
{% endblock %}
|
@@ -1,45 +0,0 @@
|
||||
{% extends 'news_base.html' %}
|
||||
{% load markup %}
|
||||
{% load mptt_tags %}
|
||||
{% load minecraft %}
|
||||
|
||||
{% block title %}News - {{item.title}}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="item news-item" itemscope itemtype="http://schema.org/BlogPosting">
|
||||
<h2><a href="{{item.get_absolute_url}}" itemprop="name">{{item.title}}</a></h2>
|
||||
<div class="byline">By <span itemprop="author">{{item.author}}</span> <div class="avatar">{% avatar item.author %}</div></div>
|
||||
<div class="dateline">On {{item.created}}</div>
|
||||
<div class="content" itemprop="articleBody">
|
||||
{{item.body|markdown}}
|
||||
</div>
|
||||
<br style="clear:both"/>
|
||||
</div>
|
||||
<div class="comments">
|
||||
<h3>Comments</h3>
|
||||
{% recursetree item.comments %}
|
||||
<div class="comment-tree">
|
||||
<div class="comment">
|
||||
<a name="c{{ node.id }}" href="#c{{node.id}}">#{{node.id}}</a>
|
||||
<div class="forum-post-user">
|
||||
{%avatar node.author%}
|
||||
{{node.author}}
|
||||
</div>
|
||||
{{node.body|markdown:"safe"}}
|
||||
<form action="{% url news.views.comment parent=node.id %}" method="post">
|
||||
{{ commentForm.as_p }}
|
||||
{% csrf_token %}
|
||||
<input type="submit" name="submit" value="Post">
|
||||
</form>
|
||||
</div>
|
||||
{{children}}
|
||||
</div>
|
||||
{% endrecursetree %}
|
||||
<h4>Add a comment</h4>
|
||||
<form action="{% url news.views.comment id=item.id %}" method="post">
|
||||
{{ commentForm.as_p }}
|
||||
{% csrf_token %}
|
||||
<input type="submit" name="submit" value="Post">
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
@@ -1,3 +0,0 @@
|
||||
{% extends "base.html" %}
|
||||
{% block sectiontitle %}News{% endblock %}
|
||||
|
@@ -1,3 +0,0 @@
|
||||
{{comment.author}} replied to your comment on {{comment.news_post}}:
|
||||
|
||||
{{comment.body}}
|
Reference in New Issue
Block a user