urls.py 1.77 KB
Newer Older
1
from django.conf.urls import patterns, include, url
David Haynes's avatar
David Haynes committed
2 3
import go.views
import django.contrib.auth.views
4
from django.contrib import admin
5 6
from django.conf import settings

7 8
admin.autodiscover()

9 10 11
handle404 = "error_404"
handle500 = "error_500"

David Haynes's avatar
David Haynes committed
12
urlpatterns = [
13
    # / - Homepage url.
David Haynes's avatar
David Haynes committed
14
    url(r'^$', go.views.index, name='index'),
15

Jean Michel Rouly's avatar
Jean Michel Rouly committed
16
    # /view/<short> - View URL data.
David Haynes's avatar
David Haynes committed
17
    url(r'^view/(?P<short>\w+)$', go.views.view, name='view'),
18

19
    # /about - About page.
David Haynes's avatar
David Haynes committed
20
    url(r'^about/?$', go.views.about, name='about'),
21

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

25
    # /my - My-Links page, view and review links.
David Haynes's avatar
David Haynes committed
26
    url(r'^my/?$', go.views.my_links, name='my_links'),
27

Jean Michel Rouly's avatar
Jean Michel Rouly committed
28
    # /delete/<short> - Delete a link, no content display.
David Haynes's avatar
David Haynes committed
29
    url(r'^delete/(?P<short>\w+)$', go.views.delete, name='delete'),
30

31
    # /registered - registration complete page
David Haynes's avatar
David Haynes committed
32
    url(r'^registered/?$', go.views.registered, name='registered'),
33

34
    # /admin - Administrator interface.
David Haynes's avatar
David Haynes committed
35
    url(r'^admin/?', admin.site.urls),
36

Chris Reffett's avatar
Chris Reffett committed
37
    # /useradmin - user approval interface
David Haynes's avatar
David Haynes committed
38 39
    url(r'^useradmin/?$', go.views.useradmin, name='useradmin'),
]
40 41 42 43 44 45 46 47 48 49 50 51 52 53
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
54

David Haynes's avatar
David Haynes committed
55
urlpatterns += [
Jean Michel Rouly's avatar
Jean Michel Rouly committed
56
    # Redirection regex.
David Haynes's avatar
David Haynes committed
57 58 59
    url(r'^(?P<short>\w+)$', go.views.redirection, name='redirection'),

]