diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py
index 3bb2c1c..fb21808 100644
a
|
b
|
def reverse(viewname, urlconf=None, args=None, kwargs=None, prefix=None, current
|
338 | 338 | elif ns not in app_list: |
339 | 339 | # The name isn't shared by one of the instances (i.e., the default) |
340 | 340 | # so just pick the first instance as the default. |
341 | | ns = app_list[0] |
| 341 | # We actually use the last as the list is reversed! |
| 342 | ns = app_list[-1] |
342 | 343 | except KeyError: |
343 | 344 | pass |
344 | 345 | |
diff --git a/tests/regressiontests/urlpatterns_reverse/tests.py b/tests/regressiontests/urlpatterns_reverse/tests.py
index d5f3ec9..e6dc262 100644
a
|
b
|
class NamespaceTests(TestCase):
|
242 | 242 | |
243 | 243 | def test_app_lookup_object_without_default(self): |
244 | 244 | "An application namespace without a default is sensitive to the 'current' app can be used for lookup" |
245 | | self.assertEquals('/other2/inner/', reverse('nodefault:urlobject-view')) |
246 | | self.assertEquals('/other2/inner/37/42/', reverse('nodefault:urlobject-view', args=[37,42])) |
247 | | self.assertEquals('/other2/inner/42/37/', reverse('nodefault:urlobject-view', kwargs={'arg1':42, 'arg2':37})) |
| 245 | self.assertEquals('/other1/inner/', reverse('nodefault:urlobject-view')) |
| 246 | self.assertEquals('/other1/inner/37/42/', reverse('nodefault:urlobject-view', args=[37,42])) |
| 247 | self.assertEquals('/other1/inner/42/37/', reverse('nodefault:urlobject-view', kwargs={'arg1':42, 'arg2':37})) |
248 | 248 | |
249 | | self.assertEquals('/other1/inner/', reverse('nodefault:urlobject-view', current_app='other-ns1')) |
250 | | self.assertEquals('/other1/inner/37/42/', reverse('nodefault:urlobject-view', args=[37,42], current_app='other-ns1')) |
251 | | self.assertEquals('/other1/inner/42/37/', reverse('nodefault:urlobject-view', kwargs={'arg1':42, 'arg2':37}, current_app='other-ns1')) |
| 249 | self.assertEquals('/other2/inner/', reverse('nodefault:urlobject-view', current_app='other-ns2')) |
| 250 | self.assertEquals('/other2/inner/37/42/', reverse('nodefault:urlobject-view', args=[37,42], current_app='other-ns2')) |
| 251 | self.assertEquals('/other2/inner/42/37/', reverse('nodefault:urlobject-view', kwargs={'arg1':42, 'arg2':37}, current_app='other-ns2')) |
252 | 252 | |
253 | 253 | class RequestURLconfTests(TestCase): |
254 | 254 | def setUp(self): |