db.models.DurationField

class DurationField(**options) [source] A field for storing periods of time - modeled in Python by timedelta. When used on PostgreSQL, the data type used is an interval and on Oracle the data type is INTERVAL DAY(9) TO SECOND(6). Otherwise a bigint of microseconds is used. Note Arithmetic with DurationField works in most cases. However on all databases other than PostgreSQL, comparing the value of a DurationField to arithmetic on DateTimeField instances will not work as expected.

db.models.DO_NOTHING

DO_NOTHING [source] Take no action. If your database backend enforces referential integrity, this will cause an IntegrityError unless you manually add an SQL ON DELETE constraint to the database field.

db.models.DecimalField.max_digits

DecimalField.max_digits The maximum number of digits allowed in the number. Note that this number must be greater than or equal to decimal_places.

db.models.DecimalField.decimal_places

DecimalField.decimal_places The number of decimal places to store with the number. For example, to store numbers up to 999 with a resolution of 2 decimal places, you’d use: models.DecimalField(..., max_digits=5, decimal_places=2) And to store numbers up to approximately one billion with a resolution of 10 decimal places: models.DecimalField(..., max_digits=19, decimal_places=10) The default form widget for this field is a NumberInput when localize is False or TextInput otherwise. Note For

db.models.DecimalField

class DecimalField(max_digits=None, decimal_places=None, **options) [source] A fixed-precision decimal number, represented in Python by a Decimal instance. Has two required arguments:

db.models.DateTimeField

class DateTimeField(auto_now=False, auto_now_add=False, **options) [source] A date and time, represented in Python by a datetime.datetime instance. Takes the same extra arguments as DateField. The default form widget for this field is a single TextInput. The admin uses two separate TextInput widgets with JavaScript shortcuts.

db.models.DateField.auto_now_add

DateField.auto_now_add Automatically set the field to now when the object is first created. Useful for creation of timestamps. Note that the current date is always used; it’s not just a default value that you can override. So even if you set a value for this field when creating the object, it will be ignored. If you want to be able to modify this field, set the following instead of auto_now_add=True: For DateField: default=date.today - from datetime.date.today() For DateTimeField: default=t

db.models.DateField.auto_now

DateField.auto_now Automatically set the field to now every time the object is saved. Useful for “last-modified” timestamps. Note that the current date is always used; it’s not just a default value that you can override. The field is only automatically updated when calling Model.save(). The field isn’t updated when making updates to other fields in other ways such as QuerySet.update(), though you can specify a custom value for the field in an update like that.

db.models.DateField

class DateField(auto_now=False, auto_now_add=False, **options) [source] A date, represented in Python by a datetime.date instance. Has a few extra, optional arguments:

db.models.Count.distinct

distinct If distinct=True, the count will only include unique instances. This is the SQL equivalent of COUNT(DISTINCT <field>). The default value is False.