classproperty
Decorator that converts a method with a single cls argument into a property that can be accessed directly from the class.
Attributes
| Attribute | Type | Description |
|---|---|---|
| fget | callable | The underlying callable method that is executed to return the property value when accessed from the class. |
Constructor
Signature
def classproperty(
method: callable = None
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| method | callable = None | The method to be converted into a class property. |
Methods
getter()
@classmethod
def getter(
method: callable
) - > [classproperty](classproperty.md?sid=django_utils_functional_classproperty)
Assigns a new method to serve as the property getter and returns the classproperty instance for decorator chaining.
Parameters
| Name | Type | Description |
|---|---|---|
| method | callable | The function to be used as the getter, which must accept a class as its first argument. |
Returns
| Type | Description |
|---|---|
[classproperty](classproperty.md?sid=django_utils_functional_classproperty) | The current classproperty instance, allowing for fluent decorator usage. |