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

4
# Django Imports
5
from django.conf.urls import include, url
David Haynes's avatar
David Haynes committed
6
import django.contrib.auth.views
7
from django.contrib import admin
8
from django.conf import settings
Grady Moran's avatar
Grady Moran committed
9
from django.views.decorators.cache import cache_page
10 11 12 13
from django.views.generic import TemplateView

# App Imports
import go.views
14

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

19
# Main list of project URL's
David Haynes's avatar
David Haynes committed
20
urlpatterns = [
21
    # / - Homepage url.
Grady Moran's avatar
Grady Moran committed
22
    url(r'^$', cache_page(4)(go.views.index), name='index'),
23

Jean Michel Rouly's avatar
Jean Michel Rouly committed
24
    # /view/<short> - View URL data.
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.
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

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

34
    # /myLinks - My-Links page, view and review links.
Grady Moran's avatar
Grady Moran committed
35
    url(r'^myLinks/?$', cache_page(10)(go.views.my_links), name='my_links'),
36

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

40
    # /registered - registration complete page
Grady Moran's avatar
Grady Moran committed
41
    url(r'^registered/?$', cache_page(60*15)(TemplateView.as_view(template_name='registered.html')),
42
        name='registered'),
43

44
    # /admin - Administrator interface.
45
    url(r'^admin/?', admin.site.urls, name='go_admin'),
46

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

# Handle authentication pages
David Haynes's avatar
David Haynes committed
52 53 54 55 56 57
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.
Robert Hitt's avatar
Robert Hitt committed
61
    url(r'^(?P<short>[-\w]+)$', go.views.redirection, name='redirection'),
David Haynes's avatar
David Haynes committed
62
]