Another Step in the Quest to clean up the code base.

This commit is contained in:
2017-09-08 07:19:50 +02:00
parent ce218080b2
commit b3ab9798b5
229 changed files with 1915 additions and 15175 deletions

View File

@@ -1,24 +1,31 @@
"""Add News and static pages to the global sitemap."""
from django.contrib.sitemaps import Sitemap
from .models import Article, Page
class ArticleSitemap(Sitemap):
"""Add the news artivles to the Sitemap"""
changefreq = "never"
priority = 0.6
def items(self):
"""only add published articles to the sitemap"""
return Article.objects.published()
def lastmod(self, article):
"""return the last modification date of the article."""
return article.date_modified
class PageSitemap(Sitemap):
"""add the static pages to the sitemap."""
changefreq = "monthly"
priority = 0.4
def items(self):
return Page.objects.all() # filter(status__gt=0)
"""add all pages to the sitemap."""
return Page.objects.all()
def lastmod(self, page):
"""return the last modification date of the page."""
return page.date_modified