diff options
| author | Michael Elovskikh | 2013-01-28 16:26:16 +0600 |
|---|---|---|
| committer | Michael Elovskikh | 2013-01-28 16:26:16 +0600 |
| commit | 499d6424aee5b71b8e6b2500bf14fa85321bfc26 (patch) | |
| tree | 34f575fb078377208ded5251aea050668355d82a /docs/api-guide/fields.md | |
| parent | 180c94dc44a9cc5b882364a58b0b12a8ab430c22 (diff) | |
| parent | 3bcd38b7d0ddaa2c051ad230cb0d749f9737fd82 (diff) | |
| download | django-rest-framework-499d6424aee5b71b8e6b2500bf14fa85321bfc26.tar.bz2 | |
Merge branch 'upstream_master' into docs_patch_method
Conflicts:
docs/api-guide/authentication.md
Diffstat (limited to 'docs/api-guide/fields.md')
| -rw-r--r-- | docs/api-guide/fields.md | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md index 5bc8f7f7..e43282ce 100644 --- a/docs/api-guide/fields.md +++ b/docs/api-guide/fields.md @@ -193,6 +193,16 @@ A date and time representation. Corresponds to `django.db.models.fields.DateTimeField` +When using `ModelSerializer` or `HyperlinkedModelSerializer`, note that any model fields with `auto_now=True` or `auto_now_add=True` will use serializer fields that are `read_only=True` by default. + +If you want to override this behavior, you'll need to declare the `DateTimeField` explicitly on the serializer. For example: + + class CommentSerializer(serializers.ModelSerializer): + created = serializers.DateTimeField() + + class Meta: + model = Comment + ## IntegerField An integer representation. |
