-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathurls.py
95 lines (77 loc) · 4.24 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
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
from django.conf.urls.defaults import *
from django.views.generic import TemplateView, RedirectView
from democratica import settings
from democratica.deputados.models import MP, Party, Mandate, LinkSet, Legislature, Fact, FactType, Activity
import democratica.deputados.views as views
import democratica.dar.views as darviews
import django.contrib.auth.views as authviews
# Enable admin interface
from django.contrib import admin
admin.autodiscover()
from haystack.query import SearchQuerySet
from haystack.views import SearchView, search_view_factory
sqs = SearchQuerySet().filter(order_by='-day')
# Enable API's
from tastypie.api import Api
from deputados.api import *
v1_api = Api(api_name='v1')
v1_api.register(MPResource())
v1_api.register(PartyResource())
v1_api.register(ConstituencyResource())
urlpatterns = patterns('',
(r'^$', TemplateView.as_view(template_name='index.html')),
(r'^acerca/$', TemplateView.as_view(template_name='acerca.html')),
url(r'^deputados/$', views.mp_list, name='mp_list'),
url(r'^deputados/(?P<object_id>\d+)/$', views.mp_detail, name='mp_detail'),
url(r'^deputados/(?P<object_id>\d+)/stats$', views.mp_statistics, name='mp_stats'),
url(r'^sessoes/$', darviews.day_list, name='calendar'),
url(r'^sessoes/(?P<year>\d+)/$', darviews.day_list, name='calendar_year'),
url(r'^sessoes/(?P<year>\d+)/(?P<month>\d+)/(?P<day>\d+)/$', darviews.day_detail, name='day_detail'),
url(r'^sessoes/(?P<year>\d+)/(?P<month>\d+)/(?P<day>\d+)/(?P<position>\d+)$', darviews.entry_detail, name='entry_detail'),
url(r'^sessoes/(?P<year>\d+)/(?P<month>\d+)/(?P<day>\d+)/edicoes/$', darviews.day_revisions, name='day_revisions'),
url(r'^sessoes/(?P<year>\d+)/(?P<month>\d+)/(?P<day>\d+)/stats$', darviews.day_statistics, name='day_stats'),
# url(r'^sessoes/intervencao/(?P<id>\d+)/$', darviews.statement_detail, name='statement_detail'),
url(r'^sessoes/marcar/(?P<id>\d+)/$', darviews.mark_as_cont, name='mark_as_cont'),
url(r'^sessoes/marcar_aparte/(?P<id>\d+)/$', darviews.mark_as_aside, name='mark_as_aside'),
url(r'^sessoes/marcar_intervencao/(?P<id>\d+)/$', darviews.mark_as_main, name='mark_as_main'),
url(r'^sessoes/desmarcar/(?P<id>\d+)/$', darviews.unmark_as_cont, name='unmark_as_cont'),
url(r'^sessoes/juntar/(?P<id>\d+)/$', darviews.join_entry_with_previous, name='join_entry_with_previous'),
url(r'^sessoes/newlines/(?P<id>\d+)/$', darviews.correct_newlines, name='correct_newlines'),
url(ur'^sessoes/catalogar/(?P<id>\d+)/$', darviews.parse_session_entries, name='parse_session_entries'),
(ur'^sessoes/gravar/$', darviews.entry_save),
(ur'^sessoes/raw/$', darviews.fetch_raw_entry),
(ur'^sessoes/reprocessar/(?P<id>\d+)/$', darviews.refresh),
(r'^pesquisa/', include('haystack.urls')),
(r'^grappelli/', include('grappelli.urls')),
url(r'^login/', authviews.login, name='login'),
url(r'^logout/', authviews.logout, name='logout'),
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/', include(admin.site.urls)),
# (r'^databrowse/(.*)', databrowse.site.root),
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
(r'^labs/$', TemplateView.as_view(template_name='labs/labs_list.html')),
(ur'^labs/doquesefalou/$', darviews.wordlist),
# api
(r'^api/', include(v1_api.urls)),
url(r'^deputados/(?P<id>\d+)/json/$', RedirectView.as_view(url='/api/v1/deputados/%(id)d/?format=json')),
url(r'^deputados/(?P<id>\d+)/xml/$', RedirectView.as_view(url='/api/v1/deputados/%(id)d/?format=xml')),
(r'^ie6/$', TemplateView.as_view(template_name='browser-update.html')),
(r'^404/$', TemplateView.as_view(template_name='404.html')),
(r'^500/$', TemplateView.as_view(template_name='500.html')),
(r'^502/$', TemplateView.as_view(template_name='502.html')),
url(r'^$', search_view_factory(
searchqueryset=sqs,
), name='haystack_search'),
)
# Enable Databrowse
'''
from django.contrib import databrowse
databrowse.site.register(MP)
databrowse.site.register(Party)
databrowse.site.register(Mandate)
databrowse.site.register(LinkSet)
databrowse.site.register(Fact)
databrowse.site.register(FactType)
databrowse.site.register(Activity)
databrowse.site.register(Legislature)
'''