source: remit/urls.py

Last change on this file was 21360c8, checked in by Alex Dehnert <adehnert@…>, 10 years ago

Django 1.6: Switch to class-based ListView?

Dango 1.5(?) removed function-based generic views, so we need to switch to the
class-based ones.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1from django.conf.urls import patterns, include, url
2from django.contrib.auth.views import login, logout
3
4import settings
5
6# Necessary views
7import finance_core.views
8from util.shortcuts import TemplateViewWithContext
9
10# Uncomment the next two lines to enable the admin:
11from django.contrib import admin
12admin.autodiscover()
13
14urlpatterns = patterns('',
15    # Example:
16    url(r'^$', TemplateViewWithContext.as_view(template_name='index.html', extra_context={ 'pagename':'homepage' }), name='homepage'),
17    (r'^vouchers/', include('vouchers.urls')),
18    (r'^finance_core/', include('finance_core.urls')),
19
20    # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
21    # to INSTALLED_APPS to enable admin documentation:
22    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
23
24    # Uncomment the next line to enable the admin:
25    (r'^admin/', include(admin.site.urls)),
26    url(r'^accounts/login/',  login,  name='login', ),
27    url(r'^accounts/logout/', logout, name='logout', ),
28)
29
30if settings.DEBUG:
31    print "In debug mode; enabling static media serving"
32    from django.views.static import serve
33    _media_url = settings.MEDIA_URL
34    if _media_url.startswith('/'):
35        _media_url = _media_url[1:]
36        urlpatterns += patterns('',
37                                (r'^%s(?P<path>.*)$' % _media_url,
38                                serve,
39                                {'document_root': settings.MEDIA_ROOT}))
40    del(_media_url, serve)
Note: See TracBrowser for help on using the repository browser.