~widelands-dev/widelands-website/pyformat_util

« back to all changes in this revision

Viewing changes to wlhelp/sitemap.py

  • Committer: franku
  • Date: 2016-11-22 21:59:30 UTC
  • mfrom: (429.3.13 sitemap)
  • Revision ID: somal@arcor.de-20161122215930-gqvgxktsezcbo6ea
Added a sitemap.xml file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from django.contrib.sitemaps import Sitemap
 
2
from wlhelp.models import Tribe, Building, Ware, Worker
 
3
 
 
4
 
 
5
class WlHelpTribeSitemap(Sitemap):
 
6
    changefreq = 'yearly'
 
7
    priority = 0.5
 
8
 
 
9
    def items(self):
 
10
        return Tribe.objects.all()
 
11
 
 
12
    def location(self, obj):
 
13
        return '/encyclopedia/%s' % obj.name
 
14
 
 
15
 
 
16
class WlHelpBuildingSitemap(Sitemap):
 
17
    changefreq = 'yearly'
 
18
    priority = 0.5
 
19
 
 
20
    def items(self):
 
21
        return Building.objects.all()
 
22
 
 
23
    def location(self, obj):
 
24
        return '/encyclopedia/%s/buildings/%s' % (obj.tribe.name, obj.name)
 
25
 
 
26
 
 
27
class WlHelpWareSitemap(Sitemap):
 
28
    changefreq = 'yearly'
 
29
    priority = 0.5
 
30
 
 
31
    def items(self):
 
32
        return Ware.objects.all()
 
33
 
 
34
    def location(self, obj):
 
35
        return '/encyclopedia/%s/wares/%s' % (obj.tribe.name, obj.name)
 
36
 
 
37
 
 
38
class WlHelpWorkerSitemap(Sitemap):
 
39
    changefreq = 'yearly'
 
40
    priority = 0.5
 
41
 
 
42
    def items(self):
 
43
        return Worker.objects.all()
 
44
 
 
45
    def location(self, obj):
 
46
        return '/encyclopedia/%s/workers/%s' % (obj.tribe.name, obj.name)