diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index 3a0ad74..b3e6077 100644
a
|
b
|
class ModelAdmin(BaseModelAdmin):
|
1009 | 1009 | |
1010 | 1010 | @csrf_protect_m |
1011 | 1011 | @transaction.commit_on_success |
1012 | | def change_view(self, request, object_id, extra_context=None): |
| 1012 | def change_view(self, request, object_id, form_url='', extra_context=None): |
1013 | 1013 | "The 'change' admin view for this model." |
1014 | 1014 | model = self.model |
1015 | 1015 | opts = model._meta |
… |
… |
class ModelAdmin(BaseModelAdmin):
|
1097 | 1097 | 'app_label': opts.app_label, |
1098 | 1098 | } |
1099 | 1099 | context.update(extra_context or {}) |
1100 | | return self.render_change_form(request, context, change=True, obj=obj) |
| 1100 | return self.render_change_form(request, context, change=True, obj=obj, form_url=form_url) |
1101 | 1101 | |
1102 | 1102 | @csrf_protect_m |
1103 | 1103 | def changelist_view(self, request, extra_context=None): |
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index b0120ce..24c5d85 100644
a
|
b
|
class AdminViewBasicTest(TestCase):
|
573 | 573 | except SuspiciousOperation: |
574 | 574 | self.fail("Filters should be allowed if they are defined on a ForeignKey pointing to this model") |
575 | 575 | |
| 576 | class AdminViewFormUrlTest(TestCase): |
| 577 | urls = "regressiontests.admin_views.urls" |
| 578 | fixtures = ["admin-views-users.xml"] |
| 579 | urlbit = "admin3" |
| 580 | |
| 581 | def setUp(self): |
| 582 | self.client.login(username='super', password='secret') |
| 583 | |
| 584 | def tearDown(self): |
| 585 | self.client.logout() |
| 586 | |
| 587 | def testChangeFormUrlHasCorrectValue(self): |
| 588 | """ |
| 589 | Tests whether change_view has form_url in request.context |
| 590 | """ |
| 591 | response = self.client.get('/test_admin/%s/admin_views/section/1/' % self.urlbit) |
| 592 | self.assertTrue('form_url' in response.context, msg='form_url not present in response.context') |
| 593 | self.assertEqual(response.context['form_url'], 'pony') |
| 594 | |
576 | 595 | class AdminJavaScriptTest(AdminViewBasicTest): |
577 | 596 | urls = "regressiontests.admin_views.urls" |
578 | 597 | |
diff --git a/tests/regressiontests/admin_views/urls.py b/tests/regressiontests/admin_views/urls.py
index 03bfbf0..da6e2cb 100644
a
|
b
|
urlpatterns = patterns('',
|
10 | 10 | (r'^test_admin/admin/secure-view/$', views.secure_view), |
11 | 11 | (r'^test_admin/admin/', include(admin.site.urls)), |
12 | 12 | (r'^test_admin/admin2/', include(customadmin.site.urls)), |
| 13 | (r'^test_admin/admin3/', include(admin.site.urls), dict(form_url='pony')), |
13 | 14 | ) |