Fixed #30864 -- Doc'd classproperty decorator.
This commit is contained in:
parent
93ed71e058
commit
4b146e0c83
1
AUTHORS
1
AUTHORS
|
@ -246,6 +246,7 @@ answer newbie questions, and generally made Django that much better:
|
|||
David Tulig <david.tulig@gmail.com>
|
||||
David Wobrock <david.wobrock@gmail.com>
|
||||
Davide Ceretti <dav.ceretti@gmail.com>
|
||||
Deep L. Sukhwani <deepsukhwani@gmail.com>
|
||||
Deepak Thukral <deep.thukral@gmail.com>
|
||||
Denis Kuzmichyov <kuzmichyov@gmail.com>
|
||||
Dennis Schwertel <dennisschwertel@gmail.com>
|
||||
|
|
|
@ -50,6 +50,10 @@ class cached_property:
|
|||
|
||||
|
||||
class classproperty:
|
||||
"""
|
||||
Decorator that converts a method with a single cls argument into a property
|
||||
that can be accessed directly from the class.
|
||||
"""
|
||||
def __init__(self, method=None):
|
||||
self.fget = method
|
||||
|
||||
|
|
|
@ -556,6 +556,14 @@ https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004
|
|||
z = person.friends # does not call
|
||||
x is z # is True
|
||||
|
||||
.. class:: classproperty(method=None)
|
||||
|
||||
.. versionadded:: 3.1
|
||||
|
||||
Similar to :py:func:`@classmethod <classmethod>`, the ``@classproperty``
|
||||
decorator converts the result of a method with a single ``cls`` argument
|
||||
into a property that can be accessed directly from the class.
|
||||
|
||||
.. function:: keep_lazy(func, *resultclasses)
|
||||
|
||||
Django offers many utility functions (particularly in ``django.utils``)
|
||||
|
|
|
@ -557,8 +557,8 @@ Miscellaneous
|
|||
``ETag`` header to responses with an empty
|
||||
:attr:`~django.http.HttpResponse.content`.
|
||||
|
||||
* ``django.utils.decorators.classproperty()`` decorator is moved to
|
||||
``django.utils.functional.classproperty()``.
|
||||
* ``django.utils.decorators.classproperty()`` decorator is made public and
|
||||
moved to :class:`django.utils.functional.classproperty()`.
|
||||
|
||||
* :tfilter:`floatformat` template filter now outputs (positive) ``0`` for
|
||||
negative numbers which round to zero.
|
||||
|
|
Loading…
Reference in New Issue