Commit a56b53f1 authored by Olivier Girardot's avatar Olivier Girardot
Browse files

refactored urls to be more normalized and use named urls + pep8

parent 5708dc6f
......@@ -9,34 +9,78 @@ from bt.feeds import RssSiteNewsFeed, AtomSiteNewsFeed
admin.autodiscover()
urlpatterns = patterns('',
(r'^$', bt.index),
(r'^list/$', bt.list_violations),
url(r'^list/(?P<country>[^/]*)(/(?P<operator>[^/]*))?$', bt.filter_violations, name="filter"),
(r'^ajax/(?P<country>[^/]*)(/(?P<operator>[^/]*))?$', bt.ajax),
(r'^add/$', bt.add),
(r'^view/(?P<id>[0-9]*)$', bt.view),
(r'^attach/(?P<id>[0-9]*)$', bt.get_attach),
(r'^(?P<id>[0-9]*)$', bt.view),
(r'^csv$', bt.ascsv),
(r'^ods$', bt.asods),
(r'^rss/$', RssSiteNewsFeed()),
(r'^atom/$', AtomSiteNewsFeed()),
(r'^activate/$', bt.activate),
(r'^confirm/(?P<id>[0-9a-z]*)$', bt.confirm),
(r'^confirm/(?P<id>[0-9]*)/(?P<name>.*)$', bt.confirm),
(r'^moderate/$', bt.moderate),
(r'^lookup/$', bt.lookup),
(r'^accounts/logout$', 'django.contrib.auth.views.logout', {'next_page' : '/'}),
(r'^accounts/', include('registration.urls')),
(r'^comments/', include('django.contrib.comments.urls')),
(r'^about/$', direct_to_template, {'template': 'nn.html'}),
(r'^start/$', direct_to_template, {'template': 'start.html'}),
(r'^contact/$', direct_to_template, {'template': 'about.html'}),
url(r'^captcha/', include('captcha.urls')),
url(r'^admin/', include(admin.site.urls)),
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'^ajax/(?P<country>[^/]*)(/(?P<operator>[^/]*))?$',
view=bt.ajax,
name="ajax_call"),
url(r'^add/$',
view=bt.add,
name="add"),
url(r'^view/(?P<id>[0-9]*)$',
view=bt.view,
name="view"),
url(r'^attach/(?P<id>[0-9]*)$',
view=bt.get_attach,
name="attach"),
url(r'^(?P<id>[0-9]*)$',
view=bt.view,
name="violation_view"),
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.contrib.comments.urls')),
url(r'^about/$',
direct_to_template, {'template': 'nn.html'}),
url(r'^start/$',
direct_to_template, {'template': 'start.html'}),
url(r'^contact/$',
direct_to_template, {'template': 'about.html'}),
url(r'^captcha/',
include('captcha.urls')),
url(r'^admin/',
include(admin.site.urls)),
)
if settings.DEV_SERVER:
urlpatterns += patterns('',
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_PATH}),
(r'^site_media/(?P<path>.*)$',
'django.views.static.serve',
{'document_root': settings.MEDIA_PATH}),
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment