class Model: (source)
Known subclasses: django.contrib.admin.models.LogEntry
, django.contrib.auth.base_user.AbstractBaseUser
, django.contrib.auth.models.Group
, django.contrib.auth.models.Permission
, django.contrib.auth.models.PermissionsMixin
, django.contrib.contenttypes.models.ContentType
, django.contrib.flatpages.models.FlatPage
, django.contrib.gis.db.backends.oracle.models.OracleGeometryColumns
, django.contrib.gis.db.backends.oracle.models.OracleSpatialRefSys
, django.contrib.gis.db.backends.postgis.models.PostGISGeometryColumns
, django.contrib.gis.db.backends.postgis.models.PostGISSpatialRefSys
, django.contrib.gis.db.backends.spatialite.models.SpatialiteGeometryColumns
, django.contrib.gis.db.backends.spatialite.models.SpatialiteSpatialRefSys
, django.contrib.redirects.models.Redirect
, django.contrib.sessions.base_session.AbstractBaseSession
, django.contrib.sites.models.Site
Undocumented
Class Method | check |
Undocumented |
Class Method | from |
Undocumented |
Method | __eq__ |
Undocumented |
Method | __getstate__ |
Hook to allow choosing the attributes to pickle. |
Method | __hash__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __reduce__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __setstate__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | clean |
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS. |
Method | clean |
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur. |
Method | date |
Undocumented |
Method | delete |
Undocumented |
Method | full |
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur. |
Method | get |
Undocumented |
Method | get |
Return a set containing names of deferred fields for this instance. |
Method | prepare |
Undocumented |
Method | refresh |
Reload field values from the database. |
Method | save |
Save the current instance. Override this in a subclass if you want to control the saving process. |
Method | save |
Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending. |
Method | serializable |
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there's no Field object with this name on the model, return the model attribute's value. |
Method | unique |
Undocumented |
Method | validate |
Undocumented |
Method | validate |
Check unique constraints on the model and raise ValidationError if any failed. |
Class Variable | pk |
Undocumented |
Class Method | _check |
Undocumented |
Class Method | _check |
Undocumented |
Class Method | _check |
Undocumented |
Class Method | _check |
Forbid field shadowing in multi-table inheritance. |
Class Method | _check |
Perform all field checks. |
Class Method | _check |
Check if `id` field is a primary key. |
Class Method | _check |
Check the value of "index_together" option. |
Class Method | _check |
Check fields, names, and conditions of indexes. |
Class Method | _check |
Undocumented |
Class Method | _check |
Check that any auto-generated column names are shorter than the limits for each database in which the model will be created. |
Class Method | _check |
Check if no relationship model is used by more than one m2m field. |
Class Method | _check |
Perform all manager checks. |
Class Method | _check |
Undocumented |
Class Method | _check |
Undocumented |
Class Method | _check |
Check "ordering" option -- is it a list of strings and do all fields exist? |
Class Method | _check |
Undocumented |
Class Method | _check |
Undocumented |
Class Method | _check |
Check if the swapped model exists. |
Class Method | _check |
Check the value of "unique_together" option. |
Class Method | _get |
Undocumented |
Method | _do |
Do an INSERT. If returning_fields is defined then this method should return the newly created data for the model. |
Method | _do |
Try to update the model. Return True if the model was updated (if an update query was done and a matching row was found in the DB). |
Method | _get_ |
Undocumented |
Method | _get |
Undocumented |
Method | _get_next_or_previous_by_ |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Return a list of checks to perform. Since validate_unique() could be called from a ModelForm, some fields may have been excluded; we can't perform a unique check on a model that is missing fields involved in that check... |
Method | _perform |
Undocumented |
Method | _perform |
Undocumented |
Method | _prepare |
Undocumented |
Method | _save |
Save all the parents of cls using values from self. |
Method | _save |
Do the heavy-lifting involved in saving. Update or insert the data for a single table. |
Method | _set |
Undocumented |
Instance Variable | _order |
Undocumented |
Instance Variable | _prefetched |
Undocumented |
Instance Variable | _state |
Undocumented |
django.contrib.admin.models.LogEntry
, django.contrib.auth.base_user.AbstractBaseUser
, django.contrib.auth.models.Group
, django.contrib.auth.models.Permission
, django.contrib.contenttypes.models.ContentType
, django.contrib.flatpages.models.FlatPage
, django.contrib.gis.db.backends.oracle.models.OracleGeometryColumns
, django.contrib.gis.db.backends.postgis.models.PostGISGeometryColumns
, django.contrib.gis.db.backends.spatialite.models.SpatialiteGeometryColumns
, django.contrib.redirects.models.Redirect
, django.contrib.sessions.base_session.AbstractBaseSession
, django.contrib.sites.models.Site
Undocumented
django.contrib.auth.base_user.AbstractBaseUser
, django.contrib.auth.models.AbstractUser
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
Reload field values from the database. By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn't loaded from any database. The using parameter will override the default. Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded. When accessing deferred fields of an instance, the deferred loading of the field will call this method.
django.contrib.auth.base_user.AbstractBaseUser
Save the current instance. Override this in a subclass if you want to control the saving process. The 'force_insert' and 'force_update' parameters can be used to insist that the "save" must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending. The 'raw' argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there's no Field object with this name on the model, return the model attribute's value. Used to serialize a field's value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.
Check that any auto-generated column names are shorter than the limits for each database in which the model will be created.
Do an INSERT. If returning_fields is defined then this method should return the newly created data for the model.
Try to update the model. Return True if the model was updated (if an update query was done and a matching row was found in the DB).
Return a list of checks to perform. Since validate_unique() could be called from a ModelForm, some fields may have been excluded; we can't perform a unique check on a model that is missing fields involved in that check. Fields that did not validate should also be excluded, but they need to be passed in via the exclude argument.