##// END OF EJS Templates
Small updates to the tag model docstrings.
Small updates to the tag model docstrings.

File last commit:

r596:5657c06f default
r623:da7c40d0 default
Show More
rss.py
79 lines | 2.0 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
Updated paginator for long page lists. Removed old get_threads method in the post manager
r596 from boards.models import Post, Tag, Thread
neko259
Implemented RSS support. This fixes #11
r89 from neboard import settings
__author__ = 'neko259'
neko259
Moved some settings to boards.settings
r333
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
Updated paginator for long page lists. Removed old get_threads method in the post manager
r596 return Thread.objects.filter(archived=False).order_by('-id')
neko259
Implemented RSS support. This fixes #11
r89
def item_title(self, item):
neko259
Fixed some issues with post model migration
r400 return item.get_opening_post().title
neko259
Implemented RSS support. This fixes #11
r89
def item_link(self, item):
neko259
Fixed some issues with post model migration
r400 return reverse('thread', args={item.get_opening_post().id})
neko259
Implemented RSS support. This fixes #11
r89
def item_pubdate(self, item):
neko259
Fixed threads list RSS
r419 return item.get_pub_time()
neko259
Implemented RSS support. This fixes #11
r89
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
Updated paginator for long page lists. Removed old get_threads method in the post manager
r596 return obj.threads.filter(archived=False).order_by('-id')
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):
neko259
Fixed some issues with post model migration
r400 return item.get_opening_post().title
neko259
Implemented RSS support. This fixes #11
r89
def item_link(self, item):
neko259
Fixed some issues with post model migration
r400 return reverse('thread', args={item.get_opening_post().id})
neko259
Implemented RSS support. This fixes #11
r89
def item_pubdate(self, item):
neko259
Fixed RSS
r402 return item.get_pub_time()
neko259
Implemented RSS support. This fixes #11
r89
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
Fixed thread RSS
r580 return obj.thread_new.get_replies()
neko259
Implemented RSS support. This fixes #11
r89
def get_object(self, request, post_id):
neko259
Fixed thread RSS
r580 return get_object_or_404(Post, id=post_id)
neko259
Implemented RSS support. This fixes #11
r89
def item_title(self, item):
return item.title
def item_link(self, item):
neko259
Fixed RSS
r402 if not item.is_opening():
return reverse('thread', args={item.thread_new.get_opening_post()
neko259
Fixed some issues with post model migration
r400 .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
r580 return obj.title