Class ModelState
Represent a Django Model. Don't use the actual Model class as it's not designed to have its options changed - instead, mutate this one and then render it into a Model as required.
Declaration
class ModelState
source linkDocumentation
Note that while you are allowed to mutate .fields, you are not allowed
to mutate the Field instances inside there themselves - you must instead
assign new ones, as these are not detached during a clone.
Methods
▷ def __init__(self, app_label, name, fields, options=None, bases=None, managers=None) ▷ def clone(self) Return an exact copy of this ModelState.
@cached_property
def name_lower(self)
▷ def render(self, apps) Create a Model object from our current state into the given apps.
Class methods
▷ def from_model(cls, model, exclude_rels=False) @classmethod Given a model, return a ModelState representing it.
@classmethod
def from_model(
cls,
model,
exclude_rels=False,
)
Reexports