mirror of
				https://github.com/django/django.git
				synced 2025-11-04 05:35:37 +00:00 
			
		
		
		
	Fixed #20691 -- Added a note for __str__() vs. __unicode__() and Python 3.
Thanks garrison for the suggestion.
This commit is contained in:
		
							parent
							
								
									3632d289de
								
							
						
					
					
						commit
						8a679386c3
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
					@ -240,6 +240,13 @@ Django will convert it to Unicode when it needs to.
 | 
				
			||||||
Choosing between ``__str__()`` and ``__unicode__()``
 | 
					Choosing between ``__str__()`` and ``__unicode__()``
 | 
				
			||||||
----------------------------------------------------
 | 
					----------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. note::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    If you are on Python 3, you can skip this section because you'll always
 | 
				
			||||||
 | 
					    create ``__str__()`` rather than ``__unicode__()``. If you'd like
 | 
				
			||||||
 | 
					    compatibility with Python 2, you can decorate your model class with
 | 
				
			||||||
 | 
					    :func:`~django.utils.encoding.python_2_unicode_compatible`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
One consequence of using Unicode by default is that you have to take some care
 | 
					One consequence of using Unicode by default is that you have to take some care
 | 
				
			||||||
when printing data from the model.
 | 
					when printing data from the model.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue