urls.py 2.38 KB
Newer Older
David Haynes's avatar
David Haynes committed
1 2 3
"""
settings/urls.py

David Haynes's avatar
David Haynes committed
4 5
The URLs of the project and their associated view that requests are routed to.
"""
6
# Future Imports
David Haynes's avatar
David Haynes committed
7 8
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)
9

10
# Django Imports
David Haynes's avatar
David Haynes committed
11
import django.contrib.auth.views
David Haynes's avatar
David Haynes committed
12
from django.conf.urls import url
13
from django.contrib import admin
Grady Moran's avatar
Grady Moran committed
14
from django.views.decorators.cache import cache_page
15 16 17 18
from django.views.generic import TemplateView

# App Imports
import go.views
19

20 21
# This function attempts to import an admin module in each installed
# application. Such modules are expected to register models with the admin.
22 23
admin.autodiscover()

David Haynes's avatar
David Haynes committed
24
urlpatterns = [
David Haynes's avatar
David Haynes committed
25 26
    # / - 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)
27
    url(r'^$', cache_page(1)(go.views.index), name='index'),
28

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

32
    # /about - About page. Cached for 15 minutes
David Haynes's avatar
David Haynes committed
33
    url(r'^about/?$',cache_page(60 * 15)(TemplateView.as_view(template_name='core/about.html')), name='about'),
34

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

David Haynes's avatar
David Haynes committed
38 39
    # /new - Create a new Go Link
    url(r'^new/?$', go.views.new_link, name='new_link'),
40

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

David Haynes's avatar
David Haynes committed
44 45 46
    # /edit/<short> - Edit link form
    url(r'^edit/(?P<short>[-\w]+)$', go.views.edit, name='edit'),

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

50
    # /registered - registration complete page. Cached for 15 minutes
David Haynes's avatar
David Haynes committed
51
    url(r'^registered/?$', cache_page(60 * 15)(TemplateView.as_view(template_name='registered.html')), name='registered'),
52

53
    # /admin - Administrator interface.
54
    url(r'^admin/?', admin.site.urls, name='go_admin'),
55

David Haynes's avatar
David Haynes committed
56 57
    # /manage - user approval interface
    url(r'^manage/?$', go.views.useradmin, name='useradmin'),
58

David Haynes's avatar
David Haynes committed
59
    # Authentication URLs
David Haynes's avatar
David Haynes committed
60
    url(r'^login$', django.contrib.auth.views.login, name='go_login'),
David Haynes's avatar
David Haynes committed
61
    url(r'^logout$', django.contrib.auth.views.logout, {'next_page': '/'}, name='go_logout'),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
62 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
]