db.models.Options.abstract

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

db.models.Options.base_manager_name

Options.base_manager_name New in Django 1.10. The name of the manager to use for the model’s _base_manager.

db.models.OneToOneField

class OneToOneField(othermodel, on_delete, parent_link=False, **options) [source] A one-to-one relationship. Conceptually, this is similar to a ForeignKey with unique=True, but the “reverse” side of the relation will directly return a single object. Changed in Django 1.9: on_delete can now be used as the second positional argument (previously it was typically only passed as a keyword argument). It will be a required argument in Django 2.0. This is most useful as the primary key of a model

db.models.Options.app_label

Options.app_label If a model is defined outside of an application in INSTALLED_APPS, it must declare which app it belongs to: app_label = 'myapp' New in Django 1.9. If you want to represent a model with the format app_label.object_name or app_label.model_name you can use model._meta.label or model._meta.label_lower respectively.

db.models.Options.db_table

Options.db_table The name of the database table to use for the model: db_table = 'music_album'

db.models.Model.__eq__()

Model.__eq__() [source] The equality method is defined such that instances with the same primary key value and the same concrete class are considered equal, except that instances with a primary key value of None aren’t equal to anything except themselves. For proxy models, concrete class is defined as the model’s first non-proxy parent; for all other models it’s simply the model’s class. For example: from django.db import models class MyModel(models.Model): id = models.AutoField(primary

db.models.Model._default_manager

Model._default_manager If you use custom Manager objects, take note that the first Manager Django encounters (in the order in which they’re defined in the model) has a special status. Django interprets the first Manager defined in a class as the “default” Manager, and several parts of Django (including dumpdata) will use that Manager exclusively for that model. As a result, it’s a good idea to be careful in your choice of default manager in order to avoid a situation where overriding get_que

db.models.Model.__hash__()

Model.__hash__() [source] The __hash__() method is based on the instance’s primary key value. It is effectively hash(obj.pk). If the instance doesn’t have a primary key value then a TypeError will be raised (otherwise the __hash__() method would return different values before and after the instance is saved, but changing the __hash__() value of an instance is forbidden in Python.

db.models.NullBooleanField

class NullBooleanField(**options) [source] Like a BooleanField, but allows NULL as one of the options. Use this instead of a BooleanField with null=True. The default form widget for this field is a NullBooleanSelect.

db.models.Model.__str__()

Model.__str__() [source] The __str__() method is called whenever you call str() on an object. Django uses str(obj) in a number of places. Most notably, to display an object in the Django admin site and as the value inserted into a template when it displays an object. Thus, you should always return a nice, human-readable representation of the model from the __str__() method. For example: from django.db import models from django.utils.encoding import python_2_unicode_compatible @python_2_unic