Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.4.X] Fixed #15566 - Documented that update() doesn't honor DateFie…

…ld.auto_now

Thanks Shabda Raaj for the draft patch.

Backport of dc01e41 from master
  • Loading branch information...
commit b0e2cb8e470acc552b4ed3fde3d5b1322b426bf2 1 parent 7e8483e
Tim Graham authored September 08, 2012
8  docs/howto/custom-model-fields.txt
@@ -181,10 +181,10 @@ card values plus their suits; 104 characters in total.
181 181
     Many of Django's model fields accept options that they don't do anything
182 182
     with. For example, you can pass both
183 183
     :attr:`~django.db.models.Field.editable` and
184  
-    :attr:`~django.db.models.Field.auto_now` to a
  184
+    :attr:`~django.db.models.DateField.auto_now` to a
185 185
     :class:`django.db.models.DateField` and it will simply ignore the
186 186
     :attr:`~django.db.models.Field.editable` parameter
187  
-    (:attr:`~django.db.models.Field.auto_now` being set implies
  187
+    (:attr:`~django.db.models.DateField.auto_now` being set implies
188 188
     ``editable=False``). No error is raised in this case.
189 189
 
190 190
     This behavior simplifies the field classes, because they don't need to
@@ -524,8 +524,8 @@ for the first time, the ``add`` parameter will be ``True``, otherwise it will be
524 524
 You only need to override this method if you want to preprocess the value
525 525
 somehow, just before saving. For example, Django's
526 526
 :class:`~django.db.models.DateTimeField` uses this method to set the attribute
527  
-correctly in the case of :attr:`~django.db.models.Field.auto_now` or
528  
-:attr:`~django.db.models.Field.auto_now_add`.
  527
+correctly in the case of :attr:`~django.db.models.DateField.auto_now` or
  528
+:attr:`~django.db.models.DateField.auto_now_add`.
529 529
 
530 530
 If you do override this method, you must return the value of the attribute at
531 531
 the end. You should also update the model's attribute if you make any changes
11  docs/topics/db/queries.txt
@@ -968,11 +968,12 @@ Be aware that the ``update()`` method is converted directly to an SQL
968 968
 statement. It is a bulk operation for direct updates. It doesn't run any
969 969
 :meth:`~django.db.models.Model.save` methods on your models, or emit the
970 970
 ``pre_save`` or ``post_save`` signals (which are a consequence of calling
971  
-:meth:`~django.db.models.Model.save`). If you want to save every item in a
972  
-:class:`~django.db.models.query.QuerySet` and make sure that the
973  
-:meth:`~django.db.models.Model.save` method is called on each instance, you
974  
-don't need any special function to handle that. Just loop over them and call
975  
-:meth:`~django.db.models.Model.save`::
  971
+:meth:`~django.db.models.Model.save`), or honor the
  972
+:attr:`~django.db.models.DateField.auto_now` field option.
  973
+If you want to save every item in a :class:`~django.db.models.query.QuerySet`
  974
+and make sure that the :meth:`~django.db.models.Model.save` method is called on
  975
+each instance, you don't need any special function to handle that. Just loop
  976
+over them and call :meth:`~django.db.models.Model.save`::
976 977
 
977 978
     for item in my_queryset:
978 979
         item.save()

0 notes on commit b0e2cb8

Please sign in to comment.
Something went wrong with that request. Please try again.