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:27:07 +0200 |
| commit | 7442eb1a242ecf9d186d4e7de1b94e360e04782d (patch) | |
| tree | 018a1fd5cf541393ae157dcf4a5ae1954616f633 /docs/internals/contributing/writing-code | |
| parent | 577b0f91894469872974ad609b4fabca949cdc1b (diff) | |
Fixed #20224 -- Update docs examples which mention __unicode__
Thanks Marc Tamlyn and Tim Graham for the review.
Diffstat (limited to 'docs/internals/contributing/writing-code')
| -rw-r--r-- | docs/internals/contributing/writing-code/coding-style.txt | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/docs/internals/contributing/writing-code/coding-style.txt b/docs/internals/contributing/writing-code/coding-style.txt index 21146600b4..437d2f7ec5 100644 --- a/docs/internals/contributing/writing-code/coding-style.txt +++ b/docs/internals/contributing/writing-code/coding-style.txt @@ -124,13 +124,16 @@ Model style first_name = models.CharField(max_length=20) last_name = models.CharField(max_length=40) +* If you define a ``__str__`` method (previously ``__unicode__`` before Python 3 + was supported), decorate the model class with + :func:`~django.utils.encoding.python_2_unicode_compatible`. + * The order of model inner classes and standard methods should be as follows (noting that these are not all required): * All database fields * Custom manager attributes * ``class Meta`` - * ``def __unicode__()`` * ``def __str__()`` * ``def save()`` * ``def get_absolute_url()`` |
