urls.py 2.26 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
# Django Imports
David Haynes's avatar
David Haynes committed
7
import django.contrib.auth.views
David Haynes's avatar
David Haynes committed
8
from django.conf.urls import url
9
from django.contrib import admin
Grady Moran's avatar
Grady Moran committed
10
from django.views.decorators.cache import cache_page
11 12 13 14
from django.views.generic import TemplateView

# App Imports
import go.views
15

16 17
# This function attempts to import an admin module in each installed
# application. Such modules are expected to register models with the admin.
18 19
admin.autodiscover()

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

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

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

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

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

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

David Haynes's avatar
David Haynes committed
40 41 42
    # /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
43
    # /delete/<short> - Delete a link, no content display.
44
    url(r'^delete/(?P<short>[-\w]+)$', go.views.delete, name='delete'),
45

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

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

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

David Haynes's avatar
David Haynes committed
55
    # Authentication URLs
David Haynes's avatar
David Haynes committed
56
    url(r'^login$', django.contrib.auth.views.login, name='go_login'),
David Haynes's avatar
David Haynes committed
57
    url(r'^logout$', django.contrib.auth.views.logout, {'next_page': '/'}, name='go_logout'),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
58 59

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