~widelands-dev/widelands-website/django_staticfiles

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from django.contrib.syndication.views import Feed, FeedDoesNotExist
from django.core.exceptions import ObjectDoesNotExist
from django.urls import reverse
from news.models import Post, Category

# Validated through http://validator.w3.org/feed/


class NewsPostsFeed(Feed):
    # RSS Feed
    title = 'Widelands news feed'
    description = 'The news section from the widelands.org homepage'
    title_template = 'news/feeds/posts_title.html'
    description_template = 'news/feeds/posts_description.html'

    def items(self):
        return Post.objects.published()[:10]

    def link(self):
        return reverse('news_index')

    def item_pubdate(self, item):
        return item.publish