[openstack-dev] horizon url namespace question

Bhandaru, Malini K malini.k.bhandaru at intel.com
Mon Oct 22 23:31:37 UTC 2012


Hello All!

I am trying to introduce a namespace to keep url patterns clean ..


_______________________________________________________________
../admin/flavors/urls.py

_______________________________________________________________

from django.conf.urls.defaults import patterns, url, include
from .views import IndexView, CreateView, EditView
from .extras import urls as extras_urls


urlpatterns = patterns('openstack_dashboard.dashboards.admin.flavors.views',
    url(r'^$', IndexView.as_view(), name='index'),
    url(r'^create/$', CreateView.as_view(), name='create'),
    url(r'^(?P<id>[^/]+)/edit/$', EditView.as_view(), name='edit'),
    url(r'^(?P<id>[^/]+)/extras/', include(extras_urls, namespace='extras'))

_______________________________________________________________

../admin/flavors/extras/urls.py
_______________________________________________________________

from django.conf.urls.defaults import patterns, url
from .views import IndexView, CreateView, EditView

urlpatterns = patterns('',
    url(r'^$', IndexView.as_view(), name='extras'),
    url(r'^create/$', CreateView.as_view(), name='create'),
    url(r'(?P<key>[^/]+)/edit/$', EditView.as_view(), name='edit')
)
__________________________________________________________________
However in the flavors table page the edit url comes out OK, but not the view extra specs link,
it shows up as horizon:admin:flavors:extras.

Not sure what I am missing .. it is as if the extras namespace is not being recognized.


<div class="btn-group"><a href='/admin/flavors/1/edit/<view-source:http://localhost:8000/admin/flavors/1/edit/>'  id="flavors__row_1__action_edit" class="btn btn-small ajax-modal btn-edit">Edit Flavor</a><a class="btn dropdown-toggle ajax-modal btn-edit" data-toggle="dropdown" href="#<view-source:http://localhost:8000/admin/flavors/#>"><span class="caret"></span></a><ul class="dropdown-menu row_actions clearfix"><li class="clearfix">
<a href='horizon:admin:flavors:extras'  id="flavors__row_1__action_extras" class="btn btn-small b t n - e d i t">View Extra Specs</a></li><li class="clearfix">
<button  id="flavors__row_1__action_delete" class="btn btn-small btn-danger btn-delete" name="action" value="flavors__delete__1" type="submit">Delete Flavor</button></li></ul></div>
</td>
</tr>



Thanks
Malini



More information about the OpenStack-dev mailing list