-
Notifications
You must be signed in to change notification settings - Fork 1
/
urls.py
70 lines (53 loc) · 1.51 KB
/
urls.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
from django.conf.urls.defaults import *
from django.views.decorators.cache import cache_page
from django.views.generic import list_detail, date_based
from django.views.generic.simple import direct_to_template, redirect_to
from django.contrib import admin
from django.contrib.sitemaps import GenericSitemap
from django.contrib.syndication.views import feed
from complaints.feeds import LatestComplaints
from complaints.models import Complaint
from complaints.views import index
# Auto-discover `admin.py`
admin.autodiscover()
# Querysets
complaints = {
'queryset': Complaint.objects.all(),
'template_object_name': 'complaint',
}
# Feeds
feeds = {
'complaints': LatestComplaints,
}
# Sitemaps
sitemaps = {
'complaints': GenericSitemap(complaints, priority=0.8),
}
# URL Patterns
urlpatterns = patterns('',
# Complaints
url(
regex = '^archive/$',
view = list_detail.object_list,
kwargs = complaints,
name = 'archive-index',
),
# Homepage
url(
regex = '^$',
view = index,
name = 'site-home'
),
# Feeds
url(
regex = '^feeds/(?P<url>.*)/$',
view = feed,
kwargs = { 'feed_dict': feeds, },
name = 'complaints-feed',
),
# Sitemaps
(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
# Administration
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/(.*)', admin.site.root),
)