Ticket #18996: 18996-2.diff

File 18996-2.diff, 1.7 KB (added by Elvard, 2 years ago)

save(), pre_save and post_save are not called

  • docs/ref/models/querysets.txt

    diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
    index d17d869..5e97fc1 100644
    a b has a side effect on your data. For more, see `Safe methods`_ in the HTTP spec. 
    13591359
    13601360.. _Safe methods: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.1.1
    13611361
     1362.. _ref-models-querysets-bulk-create:
     1363
    13621364bulk_create
    13631365~~~~~~~~~~~
    13641366
  • docs/topics/db/models.txt

    diff --git a/docs/topics/db/models.txt b/docs/topics/db/models.txt
    index f29cc28..9dcc90e 100644
    a b built-in model methods, adding new arguments. If you use ``*args, 
    762762**kwargs`` in your method definitions, you are guaranteed that your
    763763code will automatically support those arguments when they are added.
    764764
    765 .. admonition:: Overriding Delete
     765.. admonition:: Overridden model methods are not called on bulk operations
    766766
    767767    Note that the :meth:`~Model.delete()` method for an object is not
    768768    necessarily called when :ref:`deleting objects in bulk using a
    769769    QuerySet<topics-db-queries-delete>`. To ensure customized delete logic
    770770    gets executed, you can use :data:`~django.db.models.signals.pre_delete`
    771771    and/or :data:`~django.db.models.signals.post_delete` signals.
     772   
     773    Unfortunatelly there's no workaround while
     774    :ref:`creating<ref-models-querysets-bulk-create>` or
     775    :ref:`updating<topics-db-queries-update>` objects in bulk using Queryset,
     776    since neither of :meth:`~Model.save()`,
     777    :data:`~django.db.models.signals.pre_save` and
     778    :data:`~django.db.models.signals.post_save` is called.
    772779
    773780Executing custom SQL
    774781--------------------
Back to Top