~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to news/sitemap.py

  • Committer: Holger Rapp
  • Date: 2010-09-26 13:30:30 UTC
  • Revision ID: sirver@gmx.de-20100926133030-ceirjf83vde91tyt
Added a simple events model to display dates on the homepage

Show diffs side-by-side

added added

removed removed

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