urls.py 2.01 KB
Newer Older
1
# Django Imports
2
from django.conf.urls import patterns, 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
admin.autodiscover()

David Haynes's avatar
David Haynes committed
13 14
handle404 = TemplateView.as_view(template_name="admin/404.html")
handle500 = TemplateView.as_view(template_name="admin/500.html")
15

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.
David Haynes's avatar
David Haynes committed
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.
David Haynes's avatar
David Haynes committed
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 46 47 48 49 50 51 52 53 54 55 56 57
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
58

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

]