mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.8.x] Fixed #25465 -- Restored line breaks conversion in admin readonly fields.
Backport of 69208a5a1c from master
			
			
This commit is contained in:
		
				
					committed by
					
						 Tim Graham
						Tim Graham
					
				
			
			
				
	
			
			
			
						parent
						
							bd746ae341
						
					
				
				
					commit
					83174866ac
				
			| @@ -49,7 +49,7 @@ from .models import ( | ||||
|     Chapter, Character, Child, Choice, City, Collector, Color2, | ||||
|     ComplexSortedPerson, CoverLetter, CustomArticle, DooHickey, Employee, | ||||
|     EmptyModel, FancyDoodad, FieldOverridePost, FilteredManager, FooAccount, | ||||
|     FoodDelivery, FunkyTag, Gallery, Grommet, Inquisition, Language, | ||||
|     FoodDelivery, FunkyTag, Gallery, Grommet, Inquisition, Language, Link, | ||||
|     MainPrepopulated, ModelWithStringPrimaryKey, OtherStory, Paper, Parent, | ||||
|     ParentWithDependentChildren, Person, Persona, Picture, Pizza, Plot, | ||||
|     PluggableSearchPerson, Podcast, Post, Promo, Question, RelatedPrepopulated, | ||||
| @@ -4071,6 +4071,21 @@ class ReadonlyTest(TestCase): | ||||
|         response = self.client.get(reverse('admin:admin_views_post_change', args=(p.pk,))) | ||||
|         self.assertContains(response, "%d amount of cool" % p.pk) | ||||
|  | ||||
|     def test_readonly_text_field(self): | ||||
|         p = Post.objects.create( | ||||
|             title="Readonly test", content="test", | ||||
|             readonly_content='test\r\n\r\ntest\r\n\r\ntest\r\n\r\ntest', | ||||
|         ) | ||||
|         Link.objects.create( | ||||
|             url="http://www.djangoproject.com", post=p, | ||||
|             readonly_link_content="test\r\nlink", | ||||
|         ) | ||||
|         response = self.client.get(reverse('admin:admin_views_post_change', args=(p.pk,))) | ||||
|         # Checking readonly field. | ||||
|         self.assertContains(response, 'test<br /><br />test<br /><br />test<br /><br />test') | ||||
|         # Checking readonly field in inline. | ||||
|         self.assertContains(response, 'test<br />link') | ||||
|  | ||||
|     def test_readonly_post(self): | ||||
|         data = { | ||||
|             "title": "Django Got Readonly Fields", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user