mirror of
https://github.com/django/django.git
synced 2025-08-02 18:13:02 +00:00
Fixed #20224 -- Update docs examples which mention __unicode__
Thanks Marc Tamlyn and Tim Graham for the review.
This commit is contained in:
parent
577b0f9189
commit
7442eb1a24
24 changed files with 65 additions and 24 deletions
|
@ -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()``
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue