source: remit/urls.py @ 6479b5c

Last change on this file since 6479b5c was 21360c8, checked in by Alex Dehnert <adehnert@…>, 11 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
RevLine 
[ff623c3]1from django.conf.urls import patterns, include, url
[0f53aae]2from django.contrib.auth.views import login, logout
[719e4bb]3
[cafab4c]4import settings
5
[f468e6d]6# Necessary views
[7c3ea05]7import finance_core.views
[21360c8]8from util.shortcuts import TemplateViewWithContext
[f468e6d]9
[719e4bb]10# Uncomment the next two lines to enable the admin:
[13a23ce]11from django.contrib import admin
12admin.autodiscover()
[719e4bb]13
14urlpatterns = patterns('',
15    # Example:
[21360c8]16    url(r'^$', TemplateViewWithContext.as_view(template_name='index.html', extra_context={ 'pagename':'homepage' }), name='homepage'),
[7c3ea05]17    (r'^vouchers/', include('vouchers.urls')),
18    (r'^finance_core/', include('finance_core.urls')),
[719e4bb]19
20    # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
21    # to INSTALLED_APPS to enable admin documentation:
[13a23ce]22    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
[719e4bb]23
24    # Uncomment the next line to enable the admin:
[0671644]25    (r'^admin/', include(admin.site.urls)),
[0f53aae]26    url(r'^accounts/login/',  login,  name='login', ),
27    url(r'^accounts/logout/', logout, name='logout', ),
[719e4bb]28)
[cafab4c]29
30if settings.DEBUG:
[f5bebab]31    print "In debug mode; enabling static media serving"
[cafab4c]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.