##// END OF EJS Templates
Moved star to the left of tag in the tag threads list
Moved star to the left of tag in the tag threads list

File last commit:

r224:6490e2e7 default
r301:7e2c33eb default
Show More
rss.py
78 lines | 1.9 KiB | text/x-python | PythonLexer
neko259
Implemented RSS support. This fixes #11
r89 from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
neko259
Cleaned up code in some modules. Added a new style for the contributor roles.
r203 from boards.models import Post, Tag
neko259
Implemented RSS support. This fixes #11
r89 from neboard import settings
__author__ = 'neko259'
neko259
Cleaned up code in some modules. Added a new style for the contributor roles.
r203 # TODO Make tests for all of these
class AllThreadsFeed(Feed):
neko259
Implemented RSS support. This fixes #11
r89
title = settings.SITE_NAME + ' - All threads'
link = '/'
description_template = 'boards/rss/post.html'
def items(self):
neko259
Removed indexes in RSS. This is caused by problems with negative indexing, and...
r224 return Post.objects.get_threads(order_by='-pub_time')
neko259
Implemented RSS support. This fixes #11
r89
def item_title(self, item):
return item.title
def item_link(self, item):
return reverse('thread', args={item.id})
def item_pubdate(self, item):
return item.pub_time
class TagThreadsFeed(Feed):
neko259
Cleaned up code in some modules. Added a new style for the contributor roles.
r203
neko259
Implemented RSS support. This fixes #11
r89 link = '/'
description_template = 'boards/rss/post.html'
def items(self, obj):
neko259
Cleaned up code in some modules. Added a new style for the contributor roles.
r203 return Post.objects.get_threads(tag=obj,
neko259
Removed indexes in RSS. This is caused by problems with negative indexing, and...
r224 order_by='-pub_time')
neko259
Implemented RSS support. This fixes #11
r89
def get_object(self, request, tag_name):
return get_object_or_404(Tag, name=tag_name)
def item_title(self, item):
return item.title
def item_link(self, item):
return reverse('thread', args={item.id})
def item_pubdate(self, item):
return item.pub_time
def title(self, obj):
return obj.name
class ThreadPostsFeed(Feed):
neko259
Cleaned up code in some modules. Added a new style for the contributor roles.
r203
neko259
Implemented RSS support. This fixes #11
r89 link = '/'
description_template = 'boards/rss/post.html'
def items(self, obj):
neko259
Removed indexes in RSS. This is caused by problems with negative indexing, and...
r224 return Post.objects.get_thread(opening_post_id=obj)
neko259
Implemented RSS support. This fixes #11
r89
def get_object(self, request, post_id):
return post_id
def item_title(self, item):
return item.title
def item_link(self, item):
neko259
Cleaned up code in some modules. Added a new style for the contributor roles.
r203 if item.thread:
neko259
Fixed thread RSS.
r213 return reverse('thread', args={item.thread.id}) + "#" + str(item.id)
neko259
Cleaned up code in some modules. Added a new style for the contributor roles.
r203 else:
neko259
Implemented RSS support. This fixes #11
r89 return reverse('thread', args={item.id})
def item_pubdate(self, item):
return item.pub_time
def title(self, obj):
neko259
Fixed thread RSS.
r213 return get_object_or_404(Post, id=obj).title