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,20 +1,23 @@
"""To geneate a Sitemap with all events."""
from django.contrib.sitemaps import Sitemap
from django.utils import timezone
from .models import Event
from .models import Photo
class EventSitemap(Sitemap):
"""To add an event to the global sitemap."""
changefreq = "never"
protocol = 'https'
def items(self):
"""add all events to the sitemap."""
return Event.objects.all()
def priority(self, event):
delta = timezone.now() - event.start
delta = abs(delta.days / 300.0)
"""give events closer to the present a higer priority for crawlers."""
delta = abs((timezone.now() - event.start) / 300.0)
return max(1 - delta, 0.1)
def lastmod(self, event):
"""return the last modification date."""
return event.date_modified