blob: 1bf898ba684d029088044d23dbfe9dd250e82204 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
from django.template.defaultfilters import slugify
from datetime import date
from .models import Event
def get_struct():
now = date.today()
# We intentionally don't put /about/eventarchive/ in the sitemap,
# since we don't care about getting it indexed.
# We only show events in the future, so only index events in the
# future...
for n in Event.objects.filter(approved=True, enddate__gt=now):
yearsold = (now - n.startdate).days / 365
if yearsold > 4:
yearsold = 4
yield ('about/event/{}-{}/'.format(slugify(n.title), n.id),
0.5 - (yearsold / 10.0))
|