diff options
| author | Claude Paroz <claude@2xlibre.net> | 2013-07-04 15:19:33 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-07-05 19:30:08 +0200 |
| commit | a9dd6221af2148410c8a26dcbafd1ff8cc0fb107 (patch) | |
| tree | bc246344db3a47a6d2340bb6429bd0dbed0f8d20 /docs/ref/contrib | |
| parent | 430aae1b0db9fbcc15415b7bd9a14df1d88359cf (diff) | |
[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.
Diffstat (limited to 'docs/ref/contrib')
| -rw-r--r-- | docs/ref/contrib/admin/actions.txt | 1 | ||||
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 5 | ||||
| -rw-r--r-- | docs/ref/contrib/contenttypes.txt | 1 | ||||
| -rw-r--r-- | docs/ref/contrib/gis/commands.txt | 4 | ||||
| -rw-r--r-- | docs/ref/contrib/gis/layermapping.txt | 2 | ||||
| -rw-r--r-- | docs/ref/contrib/gis/tutorial.txt | 1 |
6 files changed, 10 insertions, 4 deletions
diff --git a/docs/ref/contrib/admin/actions.txt b/docs/ref/contrib/admin/actions.txt index c79f978850..65d096921f 100644 --- a/docs/ref/contrib/admin/actions.txt +++ b/docs/ref/contrib/admin/actions.txt @@ -57,6 +57,7 @@ simple news application with an ``Article`` model:: body = models.TextField() status = models.CharField(max_length=1, choices=STATUS_CHOICES) + # On Python 3: def __str__(self): def __unicode__(self): return self.title diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 318ce297a2..70db52941c 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -438,7 +438,8 @@ subclass:: list_display = ('first_name', 'last_name') If you don't set ``list_display``, the admin site will display a single - column that displays the ``__unicode__()`` representation of each object. + column that displays the ``__unicode__()`` (``__str__()`` on Python 3) + representation of each object. You have four possible values that can be used in ``list_display``: @@ -488,7 +489,7 @@ subclass:: A few special cases to note about ``list_display``: * If the field is a ``ForeignKey``, Django will display the - ``__unicode__()`` of the related object. + ``__unicode__()`` (``__str__()`` on Python 3) of the related object. * ``ManyToManyField`` fields aren't supported, because that would entail executing a separate SQL statement for each row in the table. diff --git a/docs/ref/contrib/contenttypes.txt b/docs/ref/contrib/contenttypes.txt index 199401c64a..fcd66a5b03 100644 --- a/docs/ref/contrib/contenttypes.txt +++ b/docs/ref/contrib/contenttypes.txt @@ -270,6 +270,7 @@ A simple example is a tagging system, which might look like this:: object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey('content_type', 'object_id') + # On Python 3: def __str__(self): def __unicode__(self): return self.tag diff --git a/docs/ref/contrib/gis/commands.txt b/docs/ref/contrib/gis/commands.txt index 015a1f9741..3bacb03bc1 100644 --- a/docs/ref/contrib/gis/commands.txt +++ b/docs/ref/contrib/gis/commands.txt @@ -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 diff --git a/docs/ref/contrib/gis/layermapping.txt b/docs/ref/contrib/gis/layermapping.txt index dd0a41cbc0..381c7df133 100644 --- a/docs/ref/contrib/gis/layermapping.txt +++ b/docs/ref/contrib/gis/layermapping.txt @@ -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 diff --git a/docs/ref/contrib/gis/tutorial.txt b/docs/ref/contrib/gis/tutorial.txt index 56d90c8593..3df4db12a0 100644 --- a/docs/ref/contrib/gis/tutorial.txt +++ b/docs/ref/contrib/gis/tutorial.txt @@ -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 |
