schematools.contrib.django.factories module
- schematools.contrib.django.factories.is_dangling_model(model: type[schematools.contrib.django.models.DynamicModel]) bool
Tell whether the model should have been removed, as everything reloaded.
- schematools.contrib.django.factories.model_factory(dataset: Dataset, table_schema: DatasetTableSchema, base_app_name: str | None = None, base_model: type[M] = <class 'schematools.contrib.django.models.DynamicModel'>) type[M]
Generate a Django model class from a JSON Schema definition.
- schematools.contrib.django.factories.model_mocker_factory(dataset: Dataset, table_schema: DatasetTableSchema, base_app_name: Optional[str] = None) Type[DynamicModelMocker]
Generate a Django model mocker class from a JSON Schema definition.
- schematools.contrib.django.factories.remove_dynamic_models() None
Erase model caches for dynamically generated models. This completely removes the models from the Django app registry.
If your own code also holds references to models, these need to be removed separately. The
is_dangling_model()
function allows to check whether a model originated from a previous factory invocation.