django_sorcery.db.meta.model module

Metadata for sqlalchemy models.

django_sorcery.db.meta.model.Identity

alias of django_sorcery.db.meta.model.Key

class django_sorcery.db.meta.model.model_info(model)[source]

Bases: object

A helper class that makes sqlalchemy model inspection easier.

app_config
app_label
clean_fields(instance, exclude=None, **kwargs)[source]

Clean all fields on object.

clean_nested_fields(instance, exclude=None, **kwargs)[source]

Clean all nested fields which includes composites.

clean_relation_fields(instance, exclude=None, **kwargs)[source]

Clean all relation fields.

column_properties
composites
concrete_fields
field_names
fields
full_clean(instance, exclude=None, **kwargs)[source]

Run model’s full clean chain.

This will run all of these in this order:

  • will validate all columns by using clean_<column> methods
  • will validate all nested objects (e.g. composites) with full_clean
  • will run through all registered validators on validators attribute
  • will run full model validation with self.clean()
  • if recursive kwarg is provided, will recursively clean all relations. Useful when all models need to be explicitly cleaned without flushing to DB.
get_field(field_name)[source]
get_key(instance)[source]

Returns the primary key tuple from the instance

identity_key_from_dict(kwargs)[source]

Returns identity key from a dictionary for the given model.

identity_key_from_instance(instance)[source]

Returns the primary key tuple from the instance

label
label_lower
local_fields
mapper
model
model_class
model_name
object_name
opts
ordering
primary_keys
primary_keys_from_dict(kwargs)[source]

Returns the primary key tuple from a dictionary to be used in a sqlalchemy query.get() call.

primary_keys_from_instance(instance)[source]

Return a dict containing the primary keys of the instance

private_fields
properties
relationships
run_validators(instance, exclude=None, **kwargs)[source]

Check all model validators registered on validators attribute.

sa_state(instance)[source]

Returns sqlalchemy instance state.

unique_together
verbose_name
verbose_name_plural