urls.py 2.71 KB
Newer Older
Okhin's avatar
Okhin committed
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
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView, RedirectView
from django.conf import settings
from django.contrib import admin
from bt import views as bt
from bt.feeds import RssSiteNewsFeed, AtomSiteNewsFeed

from bt.api import APIResource, OperatorResource

api_resource = APIResource()
operator_api_resource = OperatorResource()

admin.autodiscover()

urlpatterns = patterns('',
    url(r'^$',
        view=bt.index,
        name="homepage"),
    url(r'^list/$',
        view=bt.list_violations,
        name="list_violations"),
    url(r'^list/(?P<country>[^/]*)(/(?P<operator>[^/]*))?$',
        view=bt.filter_violations,
        name="filter"),
    url(r'^add/$',
        view=bt.add,
        name="add_violation"),
    # violation cannonical url and redirections
    url(r'^(?P<id>[0-9]*)$',
        RedirectView.as_view(url='/view/%(id)s')),
    url(r'^view/(?P<id>[0-9]*)$',
        view=bt.view,
        name="violation_url"),
    url(r'^attach/(?P<id>[0-9]*)$',
        view=bt.get_attach,
        name="attach"),
    # different data outputs
    url(r'^csv$',
        view=bt.ascsv,
        name="csv_output"),
    url(r'^ods$',
        view=bt.asods,
        name="ods_output"),
    url(r'^rss/$',
        view=RssSiteNewsFeed(),
        name="rss_output"),
    url(r'^atom/$',
        view=AtomSiteNewsFeed(),
        name="atom_output"),
    url(r'^activate/$',
        view=bt.activate,
        name="activate"),
    url(r'^confirm/(?P<id>[0-9a-z]*)$',
        view=bt.confirm,
        name="confirm"),
    url(r'^confirm/(?P<id>[0-9]*)/(?P<name>.*)$',
        view=bt.confirm,
        name="confirm_full"),
    url(r'^moderate/$',
        view=bt.moderate,
        name="moderate"),
    url(r'^lookup/$',
        view=bt.lookup,
        name="lookup"),
    url(r'^accounts/logout$',
        'django.contrib.auth.views.logout', {'next_page': '/'}),
    url(r'^accounts/',
        include('registration.urls')),
    url(r'^comments/',
        include('django_comments.urls')),
    url(r'^about/$',
        TemplateView.as_view(template_name='nn.html')),
    url(r'^start/$',
        TemplateView.as_view(template_name='start.html')),
    url(r'^contact/$',
        TemplateView.as_view(template_name='about.html')),
    url(r'^captcha/',
        include('captcha.urls')),
    url(r'^admin/',
        include(admin.site.urls)),
    url(r'^api/',
        include(api_resource.urls)),
    url(r'^api/',
        include(operator_api_resource.urls)),
Okhin's avatar
Okhin committed
85
86
    url(r'^search/',
        include('haystack.urls')),
Okhin's avatar
Okhin committed
87
88
89
90
91
92
93
94
)

if settings.DEV_SERVER == True:
    urlpatterns += patterns('',
        (r'^site_media/(?P<path>.*)$',
            'django.views.static.serve',
            {'document_root': settings.MEDIA_PATH}),
    )