Update syntax for relative imports
[pgweb/local.git] / pgweb / news / struct.py
blobb67c8d0f1ff3508d8094ac20a0492a372b844dc6
1 from datetime import date, timedelta
2 from .models import NewsArticle
5 def get_struct():
6 now = date.today()
7 fouryearsago = date.today() - timedelta(4 * 365, 0, 0)
9 # We intentionally don't put /about/newsarchive/ in the sitemap,
10 # since we don't care about getting it indexed.
11 # Also, don't bother indexing anything > 4 years old
13 for n in NewsArticle.objects.filter(approved=True, date__gt=fouryearsago):
14 yearsold = (now - n.date).days / 365
15 if yearsold > 4:
16 yearsold = 4
17 yield ('about/news/%s/' % n.id,
18 0.5 - (yearsold / 10.0))