-
Notifications
You must be signed in to change notification settings - Fork 8
/
urls.py
66 lines (48 loc) · 2.12 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
# -*- coding: utf-8 -*-
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.conf import settings
from parliament import views as pv
urlpatterns = [
url(r'^ajax/parliament-activity/$', pv.get_parliament_activity),
url(r'^ajax/mp-some-activity/$', pv.get_mp_some_activity),
url(r'^$', pv.main),
url(r'^session/$', pv.list_sessions),
url(r'^session/(?P<plsess>[\w-]+)/(?P<item_nr>\d+)/$', pv.show_item),
url(r'^session/(?P<plsess>[\w-]+)/(?P<item_nr>\d+)/(?P<subitem_nr>\d+)/$', pv.show_item),
url(r'^member/$', pv.list_members),
url(r'^member/(?P<member>[-\w]+)/$', pv.show_member),
url(r'^member/(?P<member>[-\w]+)/(?P<page>[-\w]+)/$', pv.show_member),
url(r'^party/$', pv.list_parties),
url(r'^party/(?P<abbreviation>[-\w]+)/$', pv.show_party_feed),
url(r'^party/(?P<abbreviation>[-\w]+)/mps/$', pv.show_party_mps),
url(r'^party/(?P<abbreviation>[-\w]+)/committees/$', pv.show_party_committees),
url(r'^topic/$', pv.list_topics),
url(r'^topic/(?P<topic>\d+)-(?P<slug>[-\w]+)/$', pv.show_topic),
url(r'^topic_by_name/$', pv.show_topic_by_name),
url(r'^document/(?P<slug>[-\w]+)/$', pv.show_document),
url(r'^info/$', pv.show_general_info),
url(r'^search/$', pv.search),
]
# A hack to automatically take name of the callback function as the
# url name. Seems to be compatible with the older stuff.
def hackpattern(pattern):
return url(pattern.pattern, pattern.callback, name=pattern.lookup_str)
urlpatterns = list(map(hackpattern, urlpatterns))
urlpatterns += [
url(r'^contact/', include('envelope.urls')),
]
from tastypie.api import Api
from parliament.api import all_resources
from social.api import UpdateResource, FeedResource
v1_api = Api(api_name='v1')
for res in all_resources:
v1_api.register(res())
v1_api.register(FeedResource())
urlpatterns += [
url(r'^api/', include(v1_api.urls)),
]
if settings.DEBUG:
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)