Skip to main content

media_property

Creates a property that dynamically aggregates Media definitions from a class and its superclasses, supporting inheritance and selective extension of media assets.

def media_property(
cls: type
) - > property

Wraps a class with a property that dynamically resolves and merges Django Media definitions from the class and its inheritance hierarchy.

Parameters

NameTypeDescription
clstypeThe class for which the media property is being created, used to look up the inner Media class and superclass assets.

Returns

TypeDescription
propertyA property object that, when accessed, returns a Media instance containing the combined assets of the class and its parents.