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