Describes the given list of models or ALL registered models. :param models: List of models to describe, if not provided then describes ALL registered models :param serializable: ``False`` if you want raw python objects, ``True`` for JSON
(
cls, models: list[type[Model]] | None = None, serializable: bool = True
)
| 170 | |
| 171 | @classmethod |
| 172 | def describe_models( |
| 173 | cls, models: list[type[Model]] | None = None, serializable: bool = True |
| 174 | ) -> dict[str, dict[str, Any]]: |
| 175 | """ |
| 176 | Describes the given list of models or ALL registered models. |
| 177 | |
| 178 | :param models: |
| 179 | List of models to describe, if not provided then describes ALL registered models |
| 180 | |
| 181 | :param serializable: |
| 182 | ``False`` if you want raw python objects, |
| 183 | ``True`` for JSON-serializable data. (Defaults to ``True``) |
| 184 | |
| 185 | :return: |
| 186 | A dictionary containing the model qualifier as key, |
| 187 | and the same output as ``describe_model(...)`` as value: |
| 188 | |
| 189 | .. code-block:: python3 |
| 190 | |
| 191 | { |
| 192 | "models.User": {...}, |
| 193 | "models.Permission": {...} |
| 194 | } |
| 195 | """ |
| 196 | |
| 197 | if not models: |
| 198 | models = [] |
| 199 | if cls.apps: |
| 200 | models = list(cls.apps.get_models_iterable()) |
| 201 | |
| 202 | return { |
| 203 | f"{model._meta.app}.{model.__name__}": model.describe(serializable) for model in models |
| 204 | } |
| 205 | |
| 206 | @classmethod |
| 207 | def _init_relations(cls) -> None: |