wrong url in document of horizon tutorial

Bug #1458436 reported by Canh Truong
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Low
Canh Truong

Bug Description

I follow the steps in tutorial "Adding a complex action to a table" and I get the error when run again horizon:

Error reversing absolute URL for <Panel: mypanel>: Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Internal Server Error: /admin/
Traceback (most recent call last):
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 137, in get_response
    response = response.render()
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/template/response.py", line 103, in render
    self.content = self.rendered_content
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/template/response.py", line 80, in rendered_content
    content = template.render(context)
  File "/opt/stack/horizon/.venv/local/lib/python2.7/site-packages/django/template/base.py", line 148, in render
    return self._render(context)
...
   (lookup_view_s, args, kwargs, len(patterns), patterns))
NoReverseMatch: Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

The url pattern is wrong. Change it as :
urlpatterns = patterns('',
    url(r'^$',
        views.IndexView.as_view(), name='index'),
    url(r'^(?P<instance_id>[^/]+)/create_snapshot/$',
        views.CreateSnapshotView.as_view(),
        name='create_snapshot'),
)
is okei.

Tutorial at: http://docs.openstack.org/developer/horizon/topics/table_actions.html

Changed in horizon:
assignee: nobody → Canh Truong (canh-v-truong)
description: updated
Changed in horizon:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/185346

Changed in horizon:
importance: Undecided → Low
milestone: none → liberty-2
Changed in horizon:
status: In Progress → Fix Committed
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: liberty-2 → 8.0.0
Revision history for this message
Johan Öhman Saldes (josal) wrote :

urlpatterns = [,
    url(r'^$',
        views.IndexView.as_view(), name='index'),
    url(r'^(?P<instance_id>[^/]+)/create_snapshot/$',
        views.CreateSnapshotView.as_view(),
        name='create_snapshot'),
]

Still gives an error for me? I removed the comma as such:

urlpatterns = [
    url(r'^$',
        views.IndexView.as_view(), name='index'),
    url(r'^(?P<instance_id>[^/]+)/create_snapshot/$',
        views.CreateSnapshotView.as_view(),
        name='create_snapshot'),
]

And it worked!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.