Mac Alexander
Mac Alexander

Reputation: 29

Error 404 Raised by a View

When I click on the laboratory link to open a form to add information to it, I get this error. I have change the url to call a diferente view and still get the same error. Can someone tell me what may be happening? Is not the view, cause as you see I use it for other urls and in those It works perfect.

Page not found (404)

Request Method: GET
Request URL:    http://localhost:8000/services/laboratory/A7509006-01
Raised by:  services.views.CreateService

template.html

<td>
  <a href="{% url 'services:createexternalservice' lab=lab.credential %}" class="btn btn-default"> External Service</a>
 </td>

urls.py

urlpatterns = patterns(
    'services.views',

url(r'^create/$', CreateService.as_view(),
    name='createexternalservice'),

url(r'^imagenology/(?P<aut_img_pk>\d+)/(?P<exam_id>\S+)/create/$',
    CreateService.as_view(),
    name='createexternalservice'),

url(r'^laboratory/(?P<lab>\S+)$', CreateService.as_view(), name='createexternalservice'),

Upvotes: 1

Views: 385

Answers (1)

alecxe
alecxe

Reputation: 474221

Your URL endpoints all have the same name - createexternalservice. This is confusing the URL routing system and there is no guarantee which URL would be called when you look it up by name. Assign them different names instead.

Upvotes: 3

Related Questions