I've noticed this behaviour in 1.7 and in the current HEAD of master (as
of 736fb1838cc25f5faf57cd2a4f6b6ab32ff9aadc).
Here's a minimal example (all files not listed are as generated by
`startproject`/`startapp`):
`testproj/urls.py`
{{{#!python
from django.conf.urls import url, include
from django.contrib import admin
import testapp.urls
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^testapp/', include(testapp.urls, namespace='testapp')),
]
}}}
`testapp/urls.py`
{{{#!python
from django.conf.urls import url, include
from django.contrib import admin
from . import views
urlpatterns = [
url(r'^myview', views.test),
]
}}}
`testapp/views.py`
{{{#!python
from django.shortcuts import render
# Create your views here.
def test():
pass
}}}
Which results in this:
{{{#!sh
> python manage.py shell
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.core.urlresolvers import reverse
>>> from testapp.views import test
>>> reverse(test)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/abrenecki/django/django/core/urlresolvers.py", line 602, in
reverse
return force_text(iri_to_uri(resolver._reverse_with_prefix(view,
prefix, *args, **kwargs)))
File "/home/abrenecki/django/django/core/urlresolvers.py", line 510, in
_reverse_with_prefix
(lookup_view_s, args, kwargs, len(patterns), patterns))
NoReverseMatch: Reverse for 'testapp.views.test' with arguments '()' and
keyword arguments '{}' not found. 0 pattern(s) tried: []
>>> exit()
}}}
If I remove the namespace, everything works as expected.
--
Ticket URL: <https://code.djangoproject.com/ticket/25035>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_better_patch: => 0
* component: Uncategorized => Core (URLs)
* needs_tests: => 0
* type: Uncategorized => Bug
* needs_docs: => 0
* resolution: => duplicate
Comment:
Duplicate of #17914
--
Ticket URL: <https://code.djangoproject.com/ticket/25035#comment:1>