forked from ifgi/optimetaPortal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsitemaps.py
More file actions
32 lines (24 loc) · 764 Bytes
/
sitemaps.py
File metadata and controls
32 lines (24 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from django.contrib.sitemaps import Sitemap
from .models import Publication
from django.urls import reverse
class PublicationsSitemap(Sitemap): # based on django.contrib.sitemaps.GenericSitemap
priority = 0.5
changefreq = "weekly"
queryset = Publication.objects.all().filter(status="p")
protocol = None
def items(self):
items = self.queryset.filter()
# items.count()
return items
def lastmod(self, item):
item.lastUpdate
class StaticViewSitemap(Sitemap):
priority = 0.5
changefreq = "monthly"
def items(self):
return ["main",
"data_and_api",
"api",
"privacy"]
def location(self, item):
return reverse(f"optimap:{item}")