urls.py 2.81 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
8
from django.urls import path, re_path, include
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
from django.views.generic import TemplateView

# App Imports
14
15
16
17
18
19
20
21
from go import views 

# Third Party
from rest_framework import routers

router = routers.DefaultRouter()
router.register('users', views.UserViewSet)
router.register('groups', views.GroupViewSet)
22

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

David Haynes's avatar
David Haynes committed
27
urlpatterns = [
28
29
30
#     # / - 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)
#     path('', cache_page(1)(go.views.index), name='index'),
31

32
33
34
35
36
#     # /view/<short> - View URL data. Cached for 15 minutes
#     re_path(r'^view/(?P<short>([\U00010000-\U0010ffff][\U0000200D]?)+)$',
#             cache_page(60 * 15)(go.views.view), name='view'),
#     re_path(r'^view/(?P<short>[-\w]+)$',
#             cache_page(60 * 15)(go.views.view), name='view'),
37

38
39
40
#     # /about - About page. Cached for 15 minutes
#     path('about', cache_page(60 * 15)
#          (TemplateView.as_view(template_name='core/about.html')), name='about'),
41

42
43
#     # /signup - Signup page for access. Cached for 15 minutes
#     path('signup', cache_page(60 * 15)(go.views.signup), name='signup'),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
44

45
46
#     # /new - Create a new Go Link
#     path('new', go.views.new_link, name='new_link'),
47

48
49
#     # /my - My-Links page, view and review links.
#     path('my', go.views.my_links, name='my_links'),
50

51
52
#     # /edit/<short> - Edit link form
#     path('edit/<slug:short>', go.views.edit, name='edit'),
David Haynes's avatar
David Haynes committed
53

54
55
#     # /delete/<short> - Delete a link, no content display.
#     path('delete/<slug:short>', go.views.delete, name='delete'),
56

57
58
59
#     # /registered - registration complete page. Cached for 15 minutes
#     path('registered', cache_page(60 * 15)
#          (TemplateView.as_view(template_name='registered.html')), name='registered'),
60

61
62
#     # /admin - Administrator interface.
#     path('admin', admin.site.urls, name='go_admin'),
63

64
65
#     # /manage - user approval interface
#     path('manage', go.views.useradmin, name='useradmin'),
66

67
68
69
     # Authentication URLs
     path('login', django.contrib.auth.views.login, name='go_login'),
     path('logout', django.contrib.auth.views.logout, {'next_page': '/'}, name='go_logout'),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
70

71
72
73
74
75
76
77
#     # Redirection regex.
#     re_path(r'^(?P<short>([\U00010000-\U0010ffff][\U0000200D]?)+)$',
#             go.views.redirection, name='redirection'),
#     re_path(r'^(?P<short>[-\w]+)$',
#             go.views.redirection, name='redirection'),
    
    path("", include(router.urls)),
David Haynes's avatar
David Haynes committed
78
]