urls.py 2.08 KB
Newer Older
1
# Django Imports
2
from django.conf.urls import include, url
David Haynes's avatar
David Haynes committed
3
import django.contrib.auth.views
4
from django.contrib import admin
5
from django.conf import settings
6 7 8 9
from django.views.generic import TemplateView

# App Imports
import go.views
10

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

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

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

23
    # /about - About page.
24
    url(r'^about/?$', TemplateView.as_view(template_name='core/about.html'), name='about'),
25

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

29
    # /my - My-Links page, view and review links.
30
    url(r'^myLinks/?$', go.views.my_links, name='my_links'),
31

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

35
    # /registered - registration complete page
36
    url(r'^registered/?$', TemplateView.as_view(template_name='registered.html'), name='registered'),
37

38
    # /admin - Administrator interface.
David Haynes's avatar
David Haynes committed
39
    url(r'^admin/?', admin.site.urls),
40

Chris Reffett's avatar
Chris Reffett committed
41
    # /useradmin - user approval interface
David Haynes's avatar
David Haynes committed
42 43
    url(r'^useradmin/?$', go.views.useradmin, name='useradmin'),
]
44 45

# Handle authentication pages
46 47 48 49 50 51 52 53 54 55 56 57 58 59
if settings.AUTH_MODE.lower() == "ldap":
    urlpatterns += [
        # Auth pages
        url(r'^login$', django.contrib.auth.views.login, {'template_name' : 'core/login.html'}, name='go_login'),
        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
60

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