<tableclass="docutils field-list"frame="void"rules="none"><colgroup><colclass="field-name"><colclass="field-body"></colgroup><tbodyvalign="top"><trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body">**signal** – A signal or a list of signals to connect a function to.</td></tr></tbody></table>
Parameters:
**signal** – A signal or a list of signals to connect a function to.
`auto_now` and `auto_now_add`这两个设置会在对象创建或更新的时刻,总是使用[_default timezone_](../../topics/i18n/timezones.html#default-current-time-zone)(默认时区)的日期. 如果你不想这样,你可以考虑一下简单地使用你自己的默认调用或者重写`save()`(在save()函数里自己添加保存时间的机制.译者注)而不是使用`auto_now` or `auto_now_add`; 或者使用`DateTimeField`字段类来替换`DateField` 并且在给用户呈现时间的时候,决定如何处理从datetime到date的转换.
想获取更多关于 [`FloatField`](#django.db.models.FloatField"django.db.models.FloatField") 和 [`DecimalField`](#django.db.models.DecimalField"django.db.models.DecimalField") 差异, 请参照 [_FloatField vs. DecimalField_](#floatfield-vs-decimalfield).
### DurationField
New in Django 1.8.
_class_`DurationField`([_**options_])
用作存储一段时间的字段类型 - 类似Python中的[`timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta"(in Python v3.4)"). 当数据库使用的是PostgreSQL, 该数据类型使用的是一个 `interval` 而在Oracle上,则使用的是 `INTERVAL DAY(9) TO SECOND(6)`. Otherwise a `bigint` of microseconds is used.
| `filename` | The filename that was originally given to the file. This may or may not be taken into account when determining the final destination path. |
Deprecated since version 1.7: 该字段已废弃,从1.7开始支持[`GenericIPAddressField`](#django.db.models.GenericIPAddressField"django.db.models.GenericIPAddressField").
field 是不同Django版本API中最根本的部分,尤其是[`models`](instances.html#django.db.models.Model "django.db.models.Model") and [`querysets`](querysets.html#django.db.models.query.QuerySet "django.db.models.query.QuerySet").
By default, if both `form_class` and `choices_form_class` are `None`, it uses [`CharField`](../forms/fields.html#django.forms.CharField "django.forms.CharField"); if `choices_form_class` is given, it returns [`TypedChoiceField`](../forms/fields.html#django.forms.TypedChoiceField "django.forms.TypedChoiceField").
每个`字段`实例包含几个允许内省其行为的属性。Use these attributes instead of `isinstance` checks when you need to write code that depends on a field’s functionality. 这些属性可与[_Model._meta API_](meta.html#model-meta-field-api)一起使用,以缩小特定字段类型的搜索范围。自定义模型字段应实现这些标志。
## Attributes for fields
`Field.auto_created`
布尔标志,指示是否自动创建字段,例如模型继承使用的`OneToOneField`。
`Field.concrete`
布尔标志,指示字段是否具有与其相关联的数据库列。
`Field.hidden`
Boolean flag that indicates if a field is used to back another non-hidden field’s functionality (e.g. the `content_type` and `object_id` fields that make up a `GenericForeignKey`). The `hidden` flag is used to distinguish what constitutes the public subset of fields on the model from all the fields on the model.
| `filename` | The filename that was originally given to the file. This may or may not be taken into account when determining the final destination path. |
...
...
@@ -4274,100 +1656,44 @@ user = models.ForeignKey(User, blank=True, null=True, on_delete=models.SET_NULL)
| [[1]](#id4) | Unless this was changed by the packager of your MySQL package. We’ve had reports that the Windows Community Server installer sets up InnoDB as the default storage engine, for example. |
| Format character | Description | Example output |
| --- | --- | --- |
| a | `'a.m.'` or `'p.m.'` (Note that this is slightly different than PHP’s output, because this includes periods to match Associated Press style.) | `'a.m.'` |
...
...
@@ -1469,7 +1468,7 @@ the output would be the string `"09/01/2008"` (the `"SHORT_DATE_FORMAT"` format