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

4
# Django Imports
David Haynes's avatar
David Haynes committed
5
from django.conf.urls import url
David Haynes's avatar
David Haynes committed
6
import django.contrib.auth.views
7
from django.contrib import admin
Grady Moran's avatar
Grady Moran committed
8
from django.views.decorators.cache import cache_page
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 = [
David Haynes's avatar
David Haynes committed
20 21
    # / - Homepage url. Cached for 1 second (this is the page you see after
    # logging in, so having it show as not logged in is strange)
22
    url(r'^$', cache_page(1)(go.views.index), name='index'),
23

24
    # /view/<short> - View URL data. Cached for 15 minutes
Grady Moran's avatar
Grady Moran committed
25
    url(r'^view/(?P<short>[-\w]+)$', cache_page(60*15)(go.views.view), name='view'),
26

27
    # /about - About page. Cached for 15 minutes
Grady Moran's avatar
Grady Moran committed
28
    url(r'^about/?$', cache_page(60*15)(TemplateView.as_view(template_name='core/about.html')),
29
        name='about'),
30

31 32
    # /signup - Signup page for access. Cached for 15 minutes
    url(r'^signup/?$', cache_page(60*15)(go.views.signup), name='signup'),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
33

34
    # /newLink - My-Links page, view and review links.
Zach Knox's avatar
Zach Knox committed
35
    url(r'^newLink/?$', go.views.new_link, name='new_link'),
36

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

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

43
    # /registered - registration complete page. Cached for 15 minutes
Grady Moran's avatar
Grady Moran committed
44
    url(r'^registered/?$', cache_page(60*15)(TemplateView.as_view(template_name='registered.html')),
45
        name='registered'),
46

47
    # /admin - Administrator interface.
48
    url(r'^admin/?', admin.site.urls, name='go_admin'),
49

Chris Reffett's avatar
Chris Reffett committed
50
    # /useradmin - user approval interface
David Haynes's avatar
David Haynes committed
51 52
    url(r'^useradmin/?$', go.views.useradmin, name='useradmin'),
]
53 54

# Handle authentication pages
David Haynes's avatar
David Haynes committed
55 56 57 58 59 60
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
61

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