Generic ObjectRequest class can be used for the rest interface
[myslice.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
19 home_view=portal.homeview.HomeView.as_view()
20 dashboard_view=portal.dashboardview.DashboardView.as_view()
21 platforms_view=portal.platformsview.PlatformsView.as_view()
22
23 import portal.testbedlist
24 import portal.sliceview
25 import portal.sliceresourceview
26 from portal.sliceuserview import SliceUserView 
27
28 #### high level choices
29 # main entry point (set to the / URL)
30 # beware that if this view is broken you end up in an endless cycle...
31 # maybe platforms_view would be best on the longer run
32 the_default_view=home_view
33 # where to be redirected after login
34 the_after_login_view=dashboard_view
35 # where to redirect when login is required
36 # might need another one ?
37 the_login_view=home_view
38 admin.autodiscover()
39 urls = [
40     '',
41     # Examples:
42     # url(r'^$', 'myslice.views.home', name='home'),
43     # url(r'^myslice/', include('myslice.foo.urls')),
44     # Uncomment the admin/doc line below to enable admin documentation:
45     # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
46     # Uncomment the next line to enable the admin:
47      url(r'^admin/', include(admin.site.urls)),
48     #
49     # default / view
50     (r'^/?$', the_default_view),
51     #
52     # login / logout
53     (r'^login-ok/?$', the_after_login_view, {'state': 'Welcome to MySlice'} ),
54     #
55     # seems to be what login_required uses to redirect ...
56     (r'^accounts/login/$', the_login_view),
57     (r'^login/?$', the_login_view),
58     (r'^logout/?$', 'auth.views.logout_user'),
59     #
60     # the manifold proxy
61     (r'^manifold/proxy/(?P<format>\w+)/?$', 'manifoldapi.manifoldproxy.proxy'),
62     #
63     #
64     # RESTful interface
65     (r'^rest/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.get.dispatch'),
66     (r'^table/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.get.dispatch'),
67     (r'^datatable/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.get.dispatch'),
68     (r'^update/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.update.dispatch'),
69     (r'^create/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.create.dispatch'),
70     (r'^delete/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.delete.dispatch'),
71     #
72     #
73     #(r'^view/?', include('view.urls')),
74     #(r'^list/slices', 'view.list.slices')
75     #
76     #
77     # Portal
78     (r'^testbeds/(?P<slicename>[^/]+)/?$', portal.testbedlist.TestbedList.as_view()),
79     (r'^resources/(?P<slicename>[^/]+)/?$', portal.sliceresourceview.SliceResourceView.as_view()),
80     (r'^users/(?P<slicename>[^/]+)/?$', SliceUserView.as_view()),
81     (r'^slice/(?P<slicename>[^/]+)/?$', portal.sliceview.SliceView.as_view()),
82     url(r'^portal/', include('portal.urls')),
83 ]
84
85 #this one would not match the convention
86 # url(r'^debug/', include('debug_platform.urls')),
87 # but it was commented out anyways
88 for aux in auxiliaries:
89     if aux in INSTALLED_APPS:
90         urls.append ( url ( r'^%s/'%aux, include ('%s.urls'%aux )))
91
92 urlpatterns = patterns(*urls)