aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorTom Christie2013-01-28 07:46:30 +0000
committerTom Christie2013-01-28 07:46:30 +0000
commita58145e20f796232ef0143f28ecb0c31dbfea92e (patch)
tree911711c70c6c45bd0e175da3756e9afadf1fd966 /docs
parent99ef0bcad994ba472882cd67a5c7d8c9b77554bf (diff)
downloaddjango-rest-framework-a58145e20f796232ef0143f28ecb0c31dbfea92e.tar.bz2
Note auto_now, auto_now_add behavior. Refs #622.
Diffstat (limited to 'docs')
-rw-r--r--docs/api-guide/fields.md10
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.