forked from rhizomedotorg/classic.rhizome.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsitemap.py
90 lines (65 loc) · 2.38 KB
/
sitemap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
from django.contrib.sitemaps import Sitemap
from news_sitemaps import register, NewsSitemap
from accounts.models import RhizomeUser
from announce.models import Event, Job, Opportunity
from artbase.models import ArtworkStub, MemberExhibition
from blog.models import Post
from discuss.models import DiscussionThread
from programs.models import Exhibition, RhizEvent
class RhizomeSitemap(Sitemap):
changefreq = 'weekly'
priority = 0.5
class NewsSitemap(NewsSitemap):
limit = 1000
def items(self):
return Post.objects.published().exclude(staff_blog=True)
def lastmod(self, obj):
return obj.publish
def genres(self, obj):
return 'Blog'
def publication_date(self, obj):
return obj.publish
def title(self, obj):
return obj.title
register(blog=NewsSitemap)
class BlogSitemap(RhizomeSitemap):
def items(self):
return Post.objects.published()
def lastmod(self, obj):
return obj.modified
class DiscussSitemap(RhizomeSitemap):
def items(self):
threads = DiscussionThread.objects.filter(is_public=True).exclude(pk=1)
return [thread for thread in threads if thread.is_discuss_thread()]
def lastmod(self, obj):
return obj.last_comment.submit_date
class EventSitemap(RhizomeSitemap):
def items(self):
return Event.objects.filter(status=True)
def lastmod(self, obj):
return obj.created
class OpportunitySitemap(RhizomeSitemap):
def items(self):
return Opportunity.objects.filter(status=True)
def lastmod(self, obj):
return obj.modified
class JobSitemap(RhizomeSitemap):
def items(self):
return Job.objects.filter(status=True)
def lastmod(self, obj):
return obj.modified
class RhizEventSitemap(RhizomeSitemap):
def items(self):
return RhizEvent.objects.all()
class RhizExhibitionsSitemap(RhizomeSitemap):
def items(self):
return Exhibition.objects.all()
class ExhibitionSitemap(RhizomeSitemap):
def items(self):
return MemberExhibition.objects.filter(live=True)
class ArtWorkSitemap(RhizomeSitemap):
def items(self):
return ArtworkStub.objects.exclude(status='deleted').exclude(status='unsubmitted')
class ProfilesSitemap(RhizomeSitemap):
def items(self):
return RhizomeUser.objects.filter(is_active=True).filter(visible=True)