Update documentation

pull/3379/head
Mike Dingjan 2017-02-10 17:29:02 +01:00 zatwierdzone przez Matt Westcott
rodzic 361df2035e
commit 8c970e4848
3 zmienionych plików z 24 dodań i 11 usunięć

Wyświetl plik

@ -8,6 +8,7 @@ Changelog
* Hooks can now specify the order in which they are run (Gagaro)
* Added a `submit_buttons` block to login template (Gagaro)
* The homepage created in the project template is now titled "Home" rather than "Homepage" (Karl Hobley)
* Signal receivers for custom `Image` and `Rendition` models are connected automatically (Mike Dingjan)
* Fix: Marked 'Date from' / 'Date to' strings in wagtailforms for translation (Vorlif)
* Fix: Unreliable preview is now reliable by always opening in a new window (Kjartan Sverrisson)
* Fix: Fixed placement of `{{ block.super }}` in `snippets/type_index.html` (LB (Ben Johnston))

Wyświetl plik

@ -22,8 +22,6 @@ Here's an example:
# models.py
from django.db import models
from django.db.models.signals import post_delete
from django.dispatch import receiver
from wagtail.wagtailimages.models import Image, AbstractImage, AbstractRendition
@ -49,16 +47,9 @@ Here's an example:
)
# Delete the source image file when an image is deleted
@receiver(post_delete, sender=CustomImage)
def image_delete(sender, instance, **kwargs):
instance.file.delete(False)
.. versionchanged:: 1.10
# Delete the rendition image file when a rendition is deleted
@receiver(post_delete, sender=CustomRendition)
def rendition_delete(sender, instance, **kwargs):
instance.file.delete(False)
In previous versions of Wagtail it was necessary to connect signal handlers to handle deletion of image files. As of Wagtail 1.10 this is now handled automatically.
.. note::

Wyświetl plik

@ -18,6 +18,8 @@ Other features
* Hooks can now specify the order in which they are run (Gagaro)
* Added a ``submit_buttons`` block to login template (Gagaro)
* The homepage created in the project template is now titled "Home" rather than "Homepage" (Karl Hobley)
* Signal receivers for custom ``Image`` and ``Rendition`` models are connected automatically (Mike Dingjan)
Bug fixes
~~~~~~~~~
@ -30,3 +32,22 @@ Bug fixes
Upgrade considerations
======================
Signals on custom ``Image`` and ``Rendition`` models connected automatically
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Projects using :ref:`custom image models <custom_image_model>` no longer need to set up signal receivers to handle deletion of image files, as this is now handled automatically by Wagtail. The following lines of code should be removed:
.. code-block:: python
# Delete the source image file when an image is deleted
@receiver(post_delete, sender=CustomImage)
def image_delete(sender, instance, **kwargs):
instance.file.delete(False)
# Delete the rendition image file when a rendition is deleted
@receiver(post_delete, sender=CustomRendition)
def rendition_delete(sender, instance, **kwargs):
instance.file.delete(False)