moviewyrm/bookwyrm/views/rss_feed.py

30 lines
719 B
Python
Raw Normal View History

2021-01-20 22:15:15 +00:00
''' '''
from django.contrib.syndication.views import Feed
from django.urls import reverse
from bookwyrm.models.user import User
from .helpers import get_activity_feed, get_user_from_username
class RssFeed(Feed):
description_template = "snippets/rss_content.html"
title_template = "snippets/rss_title.html"
def get_object(self, request, username):
return get_user_from_username(username)
def link(self, obj):
return obj.local_path
def title(self, obj):
return f"Status updates from {obj.username}"
def items(self, obj):
return get_activity_feed(obj, ['public', 'unlisted', 'followers'])
def item_link(self, item):
return item.local_path