Skip to main content

get_fields_from_path

Return list of Fields given path relative to model.

def get_fields_from_path(
model: Model,
path: str
) - > list

Return list of Fields given path relative to model.

Parameters

NameTypeDescription
modelModelThe starting Django model class from which the path traversal begins.
pathstrA string representing the relationship path using double-underscore separators (e.g., 'user__groups__name').

Returns

TypeDescription
listA list of Django Field objects representing each segment of the lookup path.