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.
141 lines
3.2 KiB
141 lines
3.2 KiB
import datetime
|
|
from django.contrib.sitemaps import Sitemap
|
|
from exposition.models import Exposition
|
|
from conference.models import Conference
|
|
from city.models import City
|
|
from country.models import Country
|
|
from theme.models import Theme, Tag
|
|
from article.models import Article
|
|
from django.core.urlresolvers import reverse
|
|
from django.core.paginator import Paginator
|
|
|
|
|
|
class Abstract(Sitemap):
|
|
changefreq = 'weekly'
|
|
priority = 0.8
|
|
|
|
def lastmod(self, obj):
|
|
return datetime.date.today()
|
|
|
|
|
|
class ExpoCard(Abstract):
|
|
changefreq = 'weekly'
|
|
priority = 0.8
|
|
|
|
def items(self):
|
|
return Exposition.enable.upcoming()
|
|
|
|
def lastmod(self, obj):
|
|
return obj.modified
|
|
|
|
class ExpoCity(Abstract):
|
|
|
|
def items(self):
|
|
return City.used.expo_cities()
|
|
|
|
def location(self, obj):
|
|
return "/expo/city/%s/" % obj.url
|
|
|
|
class ExpoCountry(Abstract):
|
|
def items(self):
|
|
return Country.objects.expo_countries()
|
|
|
|
def location(self, obj):
|
|
return "/expo/country/%s/" % obj.url
|
|
|
|
class ExpoTheme(Abstract):
|
|
def items(self):
|
|
return Theme.active.expo_themes()
|
|
|
|
def location(self, obj):
|
|
return "/expo/theme/%s/" % obj.url
|
|
|
|
class ExpoTag(Abstract):
|
|
def items(self):
|
|
return Tag.active.expo_tag()
|
|
|
|
def location(self, obj):
|
|
return "/expo/tag/%s/" % obj.url
|
|
|
|
|
|
|
|
class ConfCard(Sitemap):
|
|
changefreq = 'weekly'
|
|
priority = 0.8
|
|
|
|
def items(self):
|
|
return Conference.enable.upcoming()
|
|
|
|
def lastmod(self, obj):
|
|
return obj.modified
|
|
|
|
def location(self, obj):
|
|
return "/conference/%s/" % obj.url
|
|
|
|
|
|
class ConfCity(Abstract):
|
|
|
|
def items(self):
|
|
return City.used.conference_cities()
|
|
|
|
def location(self, obj):
|
|
return "/conference/city/%s/" % obj.url
|
|
|
|
class ConfCountry(Abstract):
|
|
def items(self):
|
|
return Country.objects.conference_countries()
|
|
|
|
def location(self, obj):
|
|
return "/conference/country/%s/" % obj.url
|
|
|
|
class ConfTheme(Abstract):
|
|
def items(self):
|
|
return Theme.active.conference_themes_with_count()
|
|
|
|
def location(self, obj):
|
|
return "/conference/theme/%s/" % obj.url
|
|
|
|
class ConfTag(Abstract):
|
|
def items(self):
|
|
return Tag.active.conference_tags()
|
|
|
|
def location(self, obj):
|
|
return "/conference/tag/%s/" % obj.url
|
|
|
|
|
|
class NewsSiteMap(Abstract):
|
|
priority = 0.5
|
|
def items(self):
|
|
return Article.objects.news().filter(publish_date__isnull=False)
|
|
|
|
def location(self, obj):
|
|
return "/news/%s/" % obj.slug
|
|
|
|
class BlogsSiteMap(Abstract):
|
|
priority = 0.5
|
|
def items(self):
|
|
return Article.objects.blogs().filter(publish_date__isnull=False)
|
|
|
|
def location(self, obj):
|
|
return "/blogs/%s/" % obj.slug
|
|
|
|
|
|
class SimpleAbstract(Sitemap):
|
|
priority = 0.5
|
|
|
|
def location(self, item):
|
|
return item
|
|
|
|
|
|
class Important(SimpleAbstract):
|
|
priority = 1
|
|
|
|
def items(self):
|
|
return ['', '/expo/', '/conference/', '/conference/country/', '/conference/city/', '/conference/theme/',
|
|
'/expo/theme/', '/expo/country/', '/expo/city/']
|
|
|
|
class Additional(SimpleAbstract):
|
|
priority = 0.5
|
|
|
|
def items(self):
|
|
return ['/blogs/', '/news/', '/partners/', '/about/', '/advertising/', '/contacts/'] |