~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to news/sitemap.py

  • Committer: franku
  • Date: 2016-11-04 08:07:18 UTC
  • mto: This revision was merged to the branch mainline in revision 434.
  • Revision ID: somal@arcor.de-20161104080718-291pc9xpym21wakc
each app has his own sitemap.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from django.contrib.sitemaps import Sitemap
2
 
from widelands.news.models import Post
 
2
from .models import Post
 
3
from datetime import datetime
 
4
from datetime import timedelta
3
5
 
4
6
 
5
7
class NewsSitemap(Sitemap):
7
9
    priority = 0.5
8
10
 
9
11
    def items(self):
10
 
        return Post.objects.published()
 
12
        start_date = datetime.today() - timedelta(days=365 * 4)
 
13
        return Post.objects.filter(publish__gt=start_date)
11
14
 
12
 
        def lastmod(self, obj):
13
 
            return obj.publish
 
15
    def lastmod(self, obj):
 
16
        return obj.publish