Inspection¶
The inspection module provides users and 3rd-party library developers a public api to access booby objects and classes internal data, such as defined fields, and some low-level type validations.
This module is based on the Python inspect module.
- inspection.get_fields(model)¶
Returns a dict mapping the given model field names to their fields.Field objects.
Parameters: model – The models.Model subclass or instance you want to get their fields. Raises: TypeError if the given model is not a model.
- inspection.is_model(obj)¶
Returns True if the given object is a models.Model instance or subclass. If not then returns False.