-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsitemaps.py
212 lines (151 loc) · 4.76 KB
/
sitemaps.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#!/usr/bin/python
# -*- coding: utf-8 -*-
import datetime
from django.db import models
from django.contrib.sitemaps import *
from django.contrib.auth.models import *
from events.models import *
from django.contrib.sites import *
from django.core.urlresolvers import *
from users.models import *
from django.core.urlresolvers import reverse
from settings import SITE_URL
from admin.urls import *
from users.urls import *
from dtvpicker.models import *
from dtvpicker.urls import *
from submissions.urls import *
from django.template.defaultfilters import slugify
# For simple urls
class EventSitemap(Sitemap):
changefreq = 'always'
priority = '0.5'
def items(self):
return Event.objects.all()
def lastmod(self, obj):
return obj.updated
def location(self, obj):
# return '/#events/' + slugify(obj.title)
try :
tab_name=Tab.objects.filter(event=obj).order_by('pref')[0].title
except:
tab_name=""
if obj.title.split('_')[0].__len__() ==1 :
return '/2013/main/events/sampark/#!events/' + slugify(obj.title)
return '/2013/main/#!events/' + slugify(obj.title)
class SiteSiteMap(Sitemap):
def __init__(self, names):
self.names = names
def items(self):
return self.names
def changefreq(self, obj):
return 'always'
def location(self, obj):
try:
if obj != None:
return reverse(obj, args=[obj.pk])
else:
return reverse(obj)
except:
return str(obj)
# admin captured parameter urls start
class EditCoreSiteMap(Sitemap):
changefreq = 'always'
priority = '0.5'
def items(self):
allusers = UserProfile.objects.all()
returnset = []
for object in allusers:
# profile=UserProfile.objects.filter(id=object.id)
if object:
if object.is_core:
returnset.append(object)
return returnset
def location(self, obj):
return '/editcore/' + str(obj.id)
class EditGroupSiteMap(Sitemap):
changefreq = 'always'
priority = '0.5'
def items(self):
allgroups = Group.objects.all()
returnset = []
for object in allgroups:
returnset.append(object)
return returnset
def location(self, obj):
return '/editgroup/' + str(obj.id)
# admin captured parameter urls end
# users captured parameter urls start
# users captured parameter urls end
# dtvpicker captured parameter urls start
class AddSubEventSiteMap(Sitemap):
changefreq = 'always'
priority = '0.5'
def items(self):
allevents = Event.objects.all()
returnset = []
for object in allevents:
returnset.append(object)
return returnset
def location(self, obj):
return '/' + str(obj.title) + '/AddSubEvent/'
class EditSubEventSiteMap(Sitemap):
changefreq = 'always'
priority = '0.5'
def items(self):
allsubevents = SubEvent.objects.all()
returnset = []
for object in allsubevents:
returnset.append(object)
return returnset
def location(self, obj):
return '/' + str(obj.event.title) + '/EditSubEvent/' \
+ str(obj.title)
class DeleteSubEventSiteMap(Sitemap):
changefreq = 'always'
priority = '0.5'
def items(self):
allsubevents = SubEvent.objects.all()
returnset = []
for object in allsubevents:
returnset.append(object)
return returnset
def location(self, obj):
return '/' + str(obj.event.title) + '/DeleteSubEvent/' \
+ str(obj.title)
class LockEventSiteMap(Sitemap):
changefreq = 'always'
priority = '0.5'
def items(self):
allevents = Event.objects.all()
returnset = []
for object in allevents:
returnset.append(object)
return returnset
def location(self, obj):
return '/' + str(obj.title) + '/LockEvent/'
class UnlockEventSiteMap(Sitemap):
changefreq = 'always'
priority = '0.5'
def items(self):
allevents = Event.objects.all()
returnset = []
for object in allevents:
returnset.append(object)
return returnset
def location(self, obj):
return '/' + str(obj.title) + '/UnlockEvent/'
# dtvpicker captured parameter urls end here
# submissions captured parameter urls start here
class Event_SubmissionSiteMap(Sitemap):
changefreq = 'always'
priority = '0.5'
def items(self):
allevents = Event.objects.all()
returnset = []
for object in allevents:
returnset.append(object)
return returnset
def location(self, obj):
return '/' + str(obj.id) + '/'
# submissions captured parameter urls end here