2013-03-09 22:37:33 +00:00
|
|
|
from django.contrib.sitemaps import Sitemap
|
|
|
|
from django.core.urlresolvers import reverse
|
|
|
|
from regluit.core.models import Work, Edition
|
|
|
|
|
|
|
|
class WorkSitemap(Sitemap):
|
|
|
|
protocol = 'https'
|
2013-03-15 16:32:29 +00:00
|
|
|
limit = 10000
|
2013-03-09 22:37:33 +00:00
|
|
|
|
|
|
|
def items(self):
|
|
|
|
return Work.objects.all()
|
|
|
|
|
|
|
|
def priority(self,work):
|
2016-01-19 22:28:45 +00:00
|
|
|
return '{:.1f}'.format(work.priority()/5.0)
|
2013-03-09 22:37:33 +00:00
|
|
|
|
|
|
|
class PublisherSitemap(Sitemap):
|
|
|
|
priority = 0.2
|
|
|
|
protocol = 'https'
|
|
|
|
|
|
|
|
def items(self):
|
2013-03-26 03:41:19 +00:00
|
|
|
return Edition.objects.exclude(publisher_name__isnull=True).order_by('publisher_name__name').values('publisher_name').distinct()
|
2013-03-09 22:37:33 +00:00
|
|
|
|
|
|
|
def location(self, pub):
|
2013-03-26 03:41:19 +00:00
|
|
|
return reverse("bypubname_list",args=[pub['publisher_name']])
|