Skip to main content

model_format_dict

Return a dict with keys 'verbose_name' and 'verbose_name_plural', typically for use with string formatting.

obj may be a Model instance, Model subclass, or QuerySet instance.

def model_format_dict(
obj: Union[Model, Type[Model], QuerySet]
) - > dict

Return a dict with keys 'verbose_name' and 'verbose_name_plural', typically for use with string formatting.

Parameters

NameTypeDescription
objUnion[Model, Type[Model], QuerySet]The object to extract naming metadata from; can be a Django Model instance, a Model class, or a QuerySet.

Returns

TypeDescription
dictA dictionary containing the 'verbose_name' and 'verbose_name_plural' attributes extracted from the object's metadata.