[Answer]-Django url NoReverseMatch works in 3rd party app but not my project

1👍

The reason is that in Django <= 3 the url tag takes url name without quotes. But in Django 1.4+ it is deprecated and url name without quotes is gone in Django 1.5:

So if you are using Django <= 1.4 do not remove the quotes (unless you are passing context variable) around url names. Instead do this for compatibility reason if you ever wanted to upgrade your django version:

{% load url from future %}
{% url 'zinnia_entry_archive_index' %}

Documentation

Don’t forget to put quotes around the function path or pattern name!

Changed in Django 1.5: The first parameter used not to be quoted, which was inconsistent > with other template tags. Since Django 1.5, it is evaluated according to the usual rules: > it can be a quoted string or a variable that will be looked up in the context.

Leave a comment