~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to wlhelp/sitemap.py

  • Committer: franku
  • Date: 2016-11-04 08:07:18 UTC
  • mto: This revision was merged to the branch mainline in revision 434.
  • Revision ID: somal@arcor.de-20161104080718-291pc9xpym21wakc
each app has his own sitemap.py

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, Ware, Worker
 
3
 
 
4
 
 
5
class WlHelpSitemap(Sitemap):
 
6
    changefreq = 'yearly'
 
7
    priority = 0.5
 
8
 
 
9
    def items(self):
 
10
        t = Tribe.objects.all()
 
11
        return t
 
12
    
 
13
    def location(self, obj):
 
14
        print('franku obj: ', obj)
 
15
        return '/encyclopedia/%s' % obj.name
 
16
 
 
17
class WlHelpTribeSitemap(Sitemap):
 
18
    changefreq = 'yearly'
 
19
    priority = 0.5
 
20
 
 
21
    def items(self):
 
22
        return Tribe.objects.all()
 
23
    
 
24
    def location(self, obj):
 
25
        return '/%s' % obj.name
 
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 '/%s' % obj.name
 
36
 
 
37
class WlHelpWorkerSitemap(Sitemap):
 
38
    changefreq = 'yearly'
 
39
    priority = 0.5
 
40
 
 
41
    def items(self):
 
42
        return Worker.objects.all()
 
43
    
 
44
    def location(self, obj):
 
45
        return '/%s' % obj.name
 
 
b'\\ No newline at end of file'