2638e4dfc974a81f362a4f1a582da29a999c64a6
[unfold.git] / myslice / urls.py
1 from django.conf.urls import patterns, include, url
2 from django.conf      import settings
3 from django.contrib import admin
4
5 # Uncomment the next two lines to enable the admin:
6 # from django.contrib import admin
7 # admin.autodiscover()
8
9 # to enable insert_above stuff
10 from django.template.loader import add_to_builtins
11 add_to_builtins('insert_above.templatetags.insert_tags')
12
13 from settings import auxiliaries, INSTALLED_APPS
14
15 import portal.platformsview
16 import portal.dashboardview
17 import portal.homeview
18 import portal.newsview
19
20 home_view=portal.homeview.HomeView.as_view()
21 dashboard_view=portal.dashboardview.DashboardView.as_view()
22 platforms_view=portal.platformsview.PlatformsView.as_view()
23
24 #import portal.testbedlist
25 import portal.sliceview
26 import portal.sliceresourceview
27
28 import portal.slicetabexperiment
29 import portal.slicetabinfo
30 import portal.slicetabtestbeds
31 import portal.slicetabusers 
32
33 #### high level choices
34 # main entry point (set to the / URL)
35 # beware that if this view is broken you end up in an endless cycle...
36 # maybe platforms_view would be best on the longer run
37 the_default_view=home_view
38 # where to be redirected after login
39 the_after_login_view=dashboard_view
40 # where to redirect when login is required
41 # might need another one ?
42 the_login_view=home_view
43 admin.autodiscover()
44 urls = [
45     '',
46     # Examples:
47     # url(r'^$', 'myslice.views.home', name='home'),
48     # url(r'^myslice/', include('myslice.foo.urls')),
49     # Uncomment the admin/doc line below to enable admin documentation:
50     # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
51     # Uncomment the next line to enable the admin:
52      url(r'^admin/', include(admin.site.urls)),
53     #
54     # default / view
55     (r'^/?$', the_default_view),
56     #
57     # login / logout
58     (r'^login-ok/?$', the_after_login_view, {'state': 'Welcome to MySlice'} ),
59     #
60     # seems to be what login_required uses to redirect ...
61     (r'^accounts/login/$', the_login_view),
62     (r'^login/?$', the_login_view),
63     (r'^logout/?$', 'auth.views.logout_user'),
64     #
65     # the manifold proxy
66     (r'^manifold/proxy/(?P<format>\w+)/?$', 'manifoldapi.manifoldproxy.proxy'),
67     #
68     #
69     # RESTful interface
70     (r'^rest/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.get.dispatch'),
71     (r'^table/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.get.dispatch'),
72     (r'^datatable/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.get.dispatch'),
73     (r'^update/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.update.dispatch'),
74     (r'^create/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.create.dispatch'),
75     (r'^delete/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.delete.dispatch'),
76     #
77     #
78     #(r'^view/?', include('view.urls')),
79     #(r'^list/slices', 'view.list.slices')
80     #
81     #
82     # Portal
83     (r'^news/?$', portal.newsview.NewsView.as_view()),
84     (r'^resources/(?P<slicename>[^/]+)/?$', portal.sliceresourceview.SliceResourceView.as_view()),
85     (r'^users/(?P<slicename>[^/]+)/?$', portal.slicetabusers.SliceUserView.as_view()),
86     
87     (r'^slice/(?P<slicename>[^/]+)/?$', portal.sliceview.SliceView.as_view()),
88     (r'^info/(?P<slicename>[^/]+)/?$', portal.slicetabinfo.SliceInfoView.as_view()),
89     (r'^testbeds/(?P<slicename>[^/]+)/?$', portal.slicetabtestbeds.SliceTabTestbeds.as_view()),
90     (r'^experiment/(?P<slicename>[^/]+)/?$', portal.slicetabexperiment.ExperimentView.as_view()),
91     url(r'^portal/', include('portal.urls')),
92 ]
93
94 #this one would not match the convention
95 # url(r'^debug/', include('debug_platform.urls')),
96 # but it was commented out anyways
97 for aux in auxiliaries:
98     if aux in INSTALLED_APPS:
99         urls.append ( url ( r'^%s/'%aux, include ('%s.urls'%aux )))
100
101 urlpatterns = patterns(*urls)