mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #2986 -- Made the JavaScript code that drives related model instance addition in a popup window handle a model representation containing new lines. Also, moved the escapejs functionality yoo django.utils.html so it can be used from Python code. Thanks andrewwatts for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15131 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -107,6 +107,22 @@ class AdminViewBasicTest(TestCase):
|
||||
response = self.client.post('/test_admin/%s/admin_views/section/add/' % self.urlbit, post_data)
|
||||
self.assertEqual(response.status_code, 302) # redirect somewhere
|
||||
|
||||
def testPopupAddPost(self):
|
||||
"""
|
||||
Ensure http response from a popup is properly escaped.
|
||||
"""
|
||||
post_data = {
|
||||
'_popup': u'1',
|
||||
'title': u'title with a new\nline',
|
||||
'content': u'some content',
|
||||
'date_0': u'2010-09-10',
|
||||
'date_1': u'14:55:39',
|
||||
}
|
||||
response = self.client.post('/test_admin/%s/admin_views/article/add/' % self.urlbit, post_data)
|
||||
self.failUnlessEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'dismissAddAnotherPopup')
|
||||
self.assertContains(response, 'title with a new\u000Aline')
|
||||
|
||||
# Post data for edit inline
|
||||
inline_post_data = {
|
||||
"name": u"Test section",
|
||||
|
||||
Reference in New Issue
Block a user