Skip to main content

warn_about_external_use

Issue a warning when a deprecated feature is used outside of Django.

def warn_about_external_use(
message: string,
category: Warning,
skip_name_prefixes: string | tuple[string] = None,
skip_frames: int = 0,
internal_modules: tuple[string] = None
)

Issue a warning when a deprecated feature is used outside of Django. Skip the warning when called from within Django, to avoid cascading warnings when one deprecated feature is implemented on top of another.

Parameters

NameTypeDescription
messagestringThe warning message text to display to the user.
categoryWarningThe warning class category (e.g., DeprecationWarning) to issue.
skip_name_prefixes`stringtuple[string]` = None
skip_framesint = 0A fixed number of additional stack frames to skip, such as decorators or shared helper functions, applied after skip_name_prefixes.
internal_modulestuple[string] = NoneA tuple of module names used to define the internal boundary; defaults to ('django',).