Model Meta options

Some Available Meta options:

Options.abstract
  If abstract = True, this model will be an abstract base class.

Options.app_label
  If a model is defined outside of an application in INSTALLED_APPS, it must declare which app it belongs to.

Options.default_related_name

  The name that will be used by default for the relation from a related object back to this one. The default is
<model_name>_set.

Options.get_latest_by
  The name of a field or a list of field names in the model, typically DateField, DateTimeField, or
IntegerField. This specifies the default field(s) to use in your model Manager’s latest() and
earliest() methods.

Options.default_permissions
  Defaults to ('add', 'change', 'delete'). You may customize this list, for example, by setting this
to an empty list if your app doesn’t require any of the default permissions. It must be specified on the model
before the model is created by migrate in order to prevent any omitted permissions from being created.

 

Options.ordering
  The default ordering for the object, for use when obtaining lists of object

猜你喜欢

转载自www.cnblogs.com/BurgundyRed/p/9724817.html
今日推荐