cmsplugin-news / cmsplugin_news /

The cms-2.0.2 branch has multiple heads

from django.contrib.sitemaps import Sitemap
from cmsplugin_news.models import News
from cmsplugin_news.feeds import RSSUrlItem

class CMSPluginNewsSitemap(Sitemap):
    changefreq = "weekly"
    priority = 0.5

    def items(self):
        news = News.published.all()

        #add the RSS Sitemap item to the list of News items
        from itertools import chain
        news = list(chain(news, [RSSUrlItem()]))

        return news

    def lastmod(self, news):
        return news.updated or news.pub_date or news.created