You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

47 lines
1.2 KiB

# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.contrib.sitemaps import Sitemap
from project.pensfonds.models import OblOtdelen, NasPunkt
class PensfondsStaticViewSitemap(Sitemap):
changefreq = 'monthly'
priority = None
def items(self):
return ['pensfonds-all']
def location(self, item):
return reverse(item)
class PensfondsOblOtdelenSitemap(Sitemap):
changefreq = 'monthly'
priority = None
def items(self):
return OblOtdelen.objects.exclude(slug__exact='').order_by('oblast').values('slug', 'updated_at')
def location(self, obj):
return reverse('pensfonds-oblast', args=[obj['slug']])
def lastmod(self, obj):
return obj['updated_at']
class PensfondsNasPunktSitemap(Sitemap):
changefreq = 'monthly'
priority = None
def items(self):
return (NasPunkt.objects.exclude(obl_otdelen__slug__exact='').exclude(slug__exact='')
.order_by('obl_otdelen', 'name')
.values('obl_otdelen__slug', 'slug', 'updated_at')
)
def location(self, obj):
return reverse('pensfonds-naspunkt', args=[obj['obl_otdelen__slug'], obj['slug']])
def lastmod(self, obj):
return obj['updated_at']