Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
NoReverseMatch for Django and DjangoCMS App

I am trying to set up some URLs for tags and categories on a forum. The links look like this

<a href="{% url 'article-list-by-tag' %}{{ tag }}" class="badge badge-info" >{{ tag }}</a>

The URL pattern article-list-by-tag comes from a DjangoCMS app called AldrynNewsblog. It can be found HERE and looks like this

url(r'^tag/(?P<tag>\w[-\w]*)/',
    TagArticleList.as_view(), name='article-list-by-tag'),

Note that the NewsBlog does not have app_name declared in its urls.py.

The app itself is part of a larger Django app called DjangoCMS. The url entry-point for the latter is declared in project's main urls.py as follows:

path('', include('cms.urls')),

The error that I am getting is

Reverse for 'article-list-by-tag' not found. 'article-list-by-tag' is not a valid view function or pattern name.

What should I do to resolve this? I have tried adding namespace to various URL entries as well as app_name to NewsBlog to no avail. The Django version being used is 2.1

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You need to pass the .slug of the tag as parameter of the URL, so:

<a href="{% url 'article-list-by-tag' tag=tag.slug %}" class="badge badge-info" >{{ tag }}</a>

If you import it with a namespace, you need to prefix the name of the view with that prefix, so 'some_namespace:article-list-by-tag'.

over 4 years ago · Santiago Trujillo Report

0

In case it helps anyone, the following code worked for my use-case:

<a href="{% namespace_url 'article-list-by-tag' tag=tag.slug %}" class="badge badge-info" >{{ tag }}</a>

Where the namespace_url is a template tag provided by DjangoCMS.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!