mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.6.x] Fixed #20224 -- Update docs examples which mention __unicode__
Thanks Marc Tamlyn and Tim Graham for the review.
Backport of 7442eb1a24 from master.
			
			
This commit is contained in:
		| @@ -65,8 +65,8 @@ of using ``ogrinspect`` :ref:`in the tutorial <ogrinspect-intro>`. | ||||
|  | ||||
| .. django-admin-option:: --name-field <name_field> | ||||
|  | ||||
|    Generates a ``__unicode__`` routine on the model that will return the | ||||
|    the given field name. | ||||
|    Generates a ``__unicode__`` routine (``__str__`` on Python 3) on the model | ||||
|    that will return the the given field name. | ||||
|  | ||||
| .. django-admin-option:: --no-imports | ||||
|  | ||||
|   | ||||
| @@ -60,6 +60,8 @@ Example | ||||
|         name = models.CharField(max_length=25) # corresponds to the 'str' field | ||||
|         poly = models.PolygonField(srid=4269) # we want our model in a different SRID | ||||
|         objects = models.GeoManager() | ||||
|  | ||||
|         # On Python 3: def __str__(self): | ||||
|         def __unicode__(self): | ||||
|             return 'Name: %s' % self.name | ||||
|  | ||||
|   | ||||
| @@ -244,6 +244,7 @@ model to represent this data:: | ||||
|         objects = models.GeoManager() | ||||
|  | ||||
|         # Returns the string representation of the model. | ||||
|         # On Python 3: def __str__(self): | ||||
|         def __unicode__(self): | ||||
|             return self.name | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user