Skip to content

Commit 7310411

Browse files
danielrosemancarltongibson
authored andcommitted
Updated example models to use __str__ in relations docs. (#6433)
1 parent 63e3525 commit 7310411

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/api-guide/relations.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ In order to explain the various types of relational fields, we'll use a couple o
4646
unique_together = ('album', 'order')
4747
ordering = ['order']
4848

49-
def __unicode__(self):
49+
def __str__(self):
5050
return '%d: %s' % (self.order, self.title)
5151

5252
## StringRelatedField
5353

54-
`StringRelatedField` may be used to represent the target of the relationship using its `__unicode__` method.
54+
`StringRelatedField` may be used to represent the target of the relationship using its `__str__` method.
5555

5656
For example, the following serializer.
5757

@@ -510,7 +510,7 @@ For example, given the following model for a tag, which has a generic relationsh
510510
object_id = models.PositiveIntegerField()
511511
tagged_object = GenericForeignKey('content_type', 'object_id')
512512

513-
def __unicode__(self):
513+
def __str__(self):
514514
return self.tag_name
515515

516516
And the following two models, which may have associated tags:

0 commit comments

Comments
 (0)