Skip to content

django_model_schema

django_spire.contrib.rest.schema.django_model_schema

TModel = TypeVar('TModel', bound='models.Model') module-attribute

DjangoModelRestSchema

Bases: RestSchema, Generic[TModel], ABC

from_django_model abstractmethod classmethod

Source code in django_spire/contrib/rest/schema/django_model_schema.py
@classmethod
@abstractmethod
def from_django_model(cls, model: type[TModel]) -> Self:
    raise NotImplementedError()

to_django_model abstractmethod classmethod

Source code in django_spire/contrib/rest/schema/django_model_schema.py
@classmethod
@abstractmethod
def to_django_model(cls) -> TModel:
    raise NotImplementedError()