Joshua de Leon
Joshua de Leon

Reputation: 59

URL not reversing in template Django

Right now I'm having issues getting the url tag to reverse back to my urls. I'm getting the NoReverseMatch. Specifically its

Error

django.urls.exceptions.NoReverseMatch: Reverse for 'documents' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

I've tried narrowing it down using other url names to reverse, but they also don't work. I'm guessing its something to do with calling the url. Any help will be awesome. If anything else is needed just let me know.

urls.py

"""urls for vivid"""
from django.conf.urls import url
from . import views

app_name = 'website'
urlpatterns = [
    url(r'^$',
        views.login_view,
        name='login'),
    url(r'^dashboard/$',
        views.dashboard_view,
        name='dashboard'),
    url(r'^home/$',
        views.home_view,
        name='home'),
    url(r'^addshow/$',
        views.show_add_view,
        name='addshow'),
    url(r'^regis/$',
        views.regis_view,
        name='regis'),
    url(r'^show/(?P<show_id>[0-9]+)/$',
        views.detail_show_view,
        name='detailshow'),
    url(r'^show/(?P<show_id>[0-9]+)/documents$',
        views.documents_view,
        name='documents'),
    url(r'^addcardcomp/$',
        views.add_card_comp,
        name='addcomp'),
    url(r'^homecardcomp/$',
        views.home_card_comp,
        name='homecomp'),

]

templates

<a href="{% url 'documents' show_id=showDocumentID %}" 

Upvotes: 0

Views: 75

Answers (1)

Nam Nguyễn
Nam Nguyễn

Reputation: 597

Try to use:

<a href="{% url 'website:documents' show_id=showDocumentID %}" 

Because: <"app_name">: <"url_name"> is better (don't conflict with other app)

Upvotes: 2

Related Questions