urls.py 2.21 KB
Newer Older
1
2
3
# Future Imports
from __future__ import unicode_literals, absolute_import, print_function, division

4
# Django Imports
5
from django.conf.urls import include, url
David Haynes's avatar
David Haynes committed
6
import django.contrib.auth.views
7
from django.contrib import admin
8
from django.conf import settings
9
10
11
12
from django.views.generic import TemplateView

# App Imports
import go.views
13

14
15
# This function attempts to import an admin module in each installed
# application. Such modules are expected to register models with the admin.
16
17
admin.autodiscover()

18
# Main list of project URL's
David Haynes's avatar
David Haynes committed
19
urlpatterns = [
20
    # / - Homepage url.
David Haynes's avatar
David Haynes committed
21
    url(r'^$', go.views.index, name='index'),
22

Jean Michel Rouly's avatar
Jean Michel Rouly committed
23
    # /view/<short> - View URL data.
24
    url(r'^view/(?P<short>[-\w]+)$', go.views.view, name='view'),
25

26
    # /about - About page.
27
28
    url(r'^about/?$', TemplateView.as_view(template_name='core/about.html'),
        name='about'),
29

Jean Michel Rouly's avatar
Jean Michel Rouly committed
30
    # /signup - Signup page for access.
David Haynes's avatar
David Haynes committed
31
    url(r'^signup/?$', go.views.signup, name='signup'),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
32

33
    # /myLinks - My-Links page, view and review links.
34
    url(r'^myLinks/?$', go.views.my_links, name='my_links'),
35

Jean Michel Rouly's avatar
Jean Michel Rouly committed
36
    # /delete/<short> - Delete a link, no content display.
37
    url(r'^delete/(?P<short>[-\w]+)$', go.views.delete, name='delete'),
38

39
    # /registered - registration complete page
40
41
    url(r'^registered/?$', TemplateView.as_view(template_name='registered.html'),
        name='registered'),
42

43
    # /admin - Administrator interface.
David Haynes's avatar
David Haynes committed
44
    url(r'^admin/?', admin.site.urls),
45

Chris Reffett's avatar
Chris Reffett committed
46
    # /useradmin - user approval interface
David Haynes's avatar
David Haynes committed
47
48
    url(r'^useradmin/?$', go.views.useradmin, name='useradmin'),
]
49
50

# Handle authentication pages
51
52
53
if settings.AUTH_MODE.lower() == "ldap":
    urlpatterns += [
        # Auth pages
54
55
        url(r'^login$', django.contrib.auth.views.login, {'template_name' : 'core/login.html'},
            name='go_login'),
56
57
58
59
60
61
62
63
64
65
        url(r'^logout$', django.contrib.auth.views.logout, {'next_page': '/'},
            name='go_logout'),
    ]
else:
    urlpatterns += [
        # Auth pages
        url(r'^login$', django.contrib.auth.views.login, name='go_login'),
        url(r'^logout$', django.contrib.auth.views.logout, {'next_page': '/'},
            name='go_logout'),
    ]
Jean Michel Rouly's avatar
Jean Michel Rouly committed
66

David Haynes's avatar
David Haynes committed
67
urlpatterns += [
Jean Michel Rouly's avatar
Jean Michel Rouly committed
68
    # Redirection regex.
Robert Hitt's avatar
Robert Hitt committed
69
    url(r'^(?P<short>[-\w]+)$', go.views.redirection, name='redirection'),
David Haynes's avatar
David Haynes committed
70
]