[Answer]-Django URL changes but doesn't render the proper view

1👍

The regular expression r'^details/(?P<outage_id>\d+)/$' does not match the URL http://localhost:8000/outage/details/1. However, it should match the expression r'^outage/details/(?P<outage_id>\d+)/$'.

Perhaps, you can post your entire urls.py to find out which view is actually being called, since you don’t get any errors. I suspect your home page is being called for all URLs.

👤arocks

0👍

Here is my url setup:

project/urls.py

urlpatterns = patterns('',
url(r'^$', 'outage.views.show_outages'),
url(r'^inventory/', include('inventory.urls')),
url(r'^outage/', include('outage.urls')),
url(r'^login', 'django.contrib.auth.views.login', {'template_name': 'templates/auth/login.html'}),
url(r'^logout', 'django.contrib.auth.views.logout', {'next_page': '/'}),
url(r'^admin/', include(admin.site.urls)),

)

outage/urls.py

urlpatterns = patterns('',
url(r'^', 'outage.views.show_outages'),
url(r'^notes/(?P<outage_id>\d+)/$', 'outage.views.outage_notes', name='notes'),

)

I have since changed the details to notes, since I had another page in a different app with a details url and I didn’t want it somehow confusing things.

👤JasonS

Leave a comment