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 ...@@ -9,34 +9,78 @@ from bt.feeds import RssSiteNewsFeed, AtomSiteNewsFeed
admin.autodiscover() admin.autodiscover()
urlpatterns = patterns('', urlpatterns = patterns('',
(r'^$', bt.index), url(r'^$',
(r'^list/$', bt.list_violations), view=bt.index,
url(r'^list/(?P<country>[^/]*)(/(?P<operator>[^/]*))?$', bt.filter_violations, name="filter"), name="homepage"),
(r'^ajax/(?P<country>[^/]*)(/(?P<operator>[^/]*))?$', bt.ajax), url(r'^list/$',
(r'^add/$', bt.add), view=bt.list_violations,
(r'^view/(?P<id>[0-9]*)$', bt.view), name="list_violations"),
(r'^attach/(?P<id>[0-9]*)$', bt.get_attach), url(r'^list/(?P<country>[^/]*)(/(?P<operator>[^/]*))?$',
(r'^(?P<id>[0-9]*)$', bt.view), view=bt.filter_violations,
(r'^csv$', bt.ascsv), name="filter"),
(r'^ods$', bt.asods), url(r'^ajax/(?P<country>[^/]*)(/(?P<operator>[^/]*))?$',
(r'^rss/$', RssSiteNewsFeed()), view=bt.ajax,
(r'^atom/$', AtomSiteNewsFeed()), name="ajax_call"),
(r'^activate/$', bt.activate), url(r'^add/$',
(r'^confirm/(?P<id>[0-9a-z]*)$', bt.confirm), view=bt.add,
(r'^confirm/(?P<id>[0-9]*)/(?P<name>.*)$', bt.confirm), name="add"),
(r'^moderate/$', bt.moderate), url(r'^view/(?P<id>[0-9]*)$',
(r'^lookup/$', bt.lookup), view=bt.view,
(r'^accounts/logout$', 'django.contrib.auth.views.logout', {'next_page' : '/'}), name="view"),
(r'^accounts/', include('registration.urls')), url(r'^attach/(?P<id>[0-9]*)$',
(r'^comments/', include('django.contrib.comments.urls')), view=bt.get_attach,
(r'^about/$', direct_to_template, {'template': 'nn.html'}), name="attach"),
(r'^start/$', direct_to_template, {'template': 'start.html'}), url(r'^(?P<id>[0-9]*)$',
(r'^contact/$', direct_to_template, {'template': 'about.html'}), view=bt.view,
url(r'^captcha/', include('captcha.urls')), name="violation_view"),
url(r'^admin/', include(admin.site.urls)), 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: if settings.DEV_SERVER:
urlpatterns += patterns('', 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