diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 587d5d9fff..489faa243e 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -364,12 +364,9 @@ class URLNode(Node): try: return reverse(self.view_name, args=args, kwargs=kwargs) except NoReverseMatch: - try: - project_name = settings.SETTINGS_MODULE.split('.')[0] - return reverse(project_name + '.' + self.view_name, - args=args, kwargs=kwargs) - except NoReverseMatch: - return '' + project_name = settings.SETTINGS_MODULE.split('.')[0] + return reverse(project_name + '.' + self.view_name, + args=args, kwargs=kwargs) class WidthRatioNode(Node): def __init__(self, val_expr, max_expr, max_width): diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py index e3a7091212..13b8c6b488 100644 --- a/tests/regressiontests/templates/tests.py +++ b/tests/regressiontests/templates/tests.py @@ -11,6 +11,7 @@ import unittest from datetime import datetime, timedelta from django import template +from django.core import urlresolvers from django.template import loader from django.template.loaders import app_directories, filesystem from django.utils.translation import activate, deactivate, ugettext as _ @@ -888,8 +889,8 @@ class Templates(unittest.TestCase): # Failures 'url-fail01': ('{% url %}', {}, template.TemplateSyntaxError), - 'url-fail02': ('{% url no_such_view %}', {}, ''), - 'url-fail03': ('{% url regressiontests.templates.views.client no_such_param="value" %}', {}, ''), + 'url-fail02': ('{% url no_such_view %}', {}, urlresolvers.NoReverseMatch), + 'url-fail03': ('{% url regressiontests.templates.views.client %}', {}, urlresolvers.NoReverseMatch), ### CACHE TAG ###################################################### 'cache01': ('{% load cache %}{% cache -1 test %}cache01{% endcache %}', {}, 'cache01'),